Package org.w3c.dom

Examples of org.w3c.dom.Text


            Element tspan = doc.createElementNS("http://www.w3.org/2000/svg", "tspan");
            tspan.setAttributeNS(null, "x", String.valueOf(txtXLeft));
            tspan.setAttributeNS(null, "y", String.valueOf(txtYTop));
            tspan.setAttributeNS(null, "id", "tspan-" + imgName);

            Text text2 = doc.createTextNode(imgDisplayName);
            tspan.appendChild(text2);

            text1.appendChild(tspan);
            a.appendChild(text1);
        }
View Full Code Here


        Node node = e.getFirstChild();
        if (node != null) {
            do {
                short nodeType = node.getNodeType();
                if (nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE) {
                    Text text = (Text) node;
                    result.append(text.getData());
                }
            } while ((node = node.getNextSibling()) != null);
        }
        return result.toString().trim();
    }
View Full Code Here

    for (int i = 0; i < nl.getLength(); i++)
    {
      final Node n = nl.item(i);
      if (n.getNodeType() == Node.TEXT_NODE)
      {
        final Text text = (Text) n;

        result.append(text.getData());
      }
      else if (n.getNodeType() == Node.ENTITY_REFERENCE_NODE)
      {
        result.append('&');
        result.append(n.getNodeName());
View Full Code Here

    {
        final Document document = createDocument();
        final String name = "meep";
        final String value = "text";
        final Element element = document.createElement( name );
        final Text text = document.createTextNode( value );
        element.appendChild( text );
        final Configuration configuration = ConfigurationUtil.toConfiguration( element );

        assertEquals( "configuration.getName()", name, configuration.getName() );
        assertEquals( "configuration.getPath()",
View Full Code Here

    {
        final Document document = createDocument();
        final String name = "meep";
        final String value = "text";
        final Element element = document.createElement( name );
        final Text text = document.createTextNode( value );
        element.appendChild( text );
        final Text text2 = document.createTextNode( value );
        element.appendChild( text2 );
        final Configuration configuration = ConfigurationUtil.toConfiguration( element );

        assertEquals( "configuration.getName()", name, configuration.getName() );
        assertEquals( "configuration.getPath()",
View Full Code Here

  
         ResultSetMetaData rsmd = rs.getMetaData();
         int               columns = rsmd.getColumnCount();

         Element       numColumns = doc.createElement("numcolumns");
         Text          numColumnsValue = doc.createTextNode("" + columns);

         numColumns.appendChild(numColumnsValue);
         desc.appendChild(numColumns);

         Element columnNames = doc.createElement("columnnames");

         for (int i = 1, j = columns; i <= j; i++) {
            columnName = rsmd.getColumnName(i);
            Element name = doc.createElement("column");
            Text        value = doc.createTextNode(columnName);

            name.appendChild(value);
            columnNames.appendChild(name);
         }

         desc.appendChild(columnNames);

         while (rs.next()) {
            if (log.isLoggable(Level.FINE)) log.fine("Scanning SQL result with rowlimit=" + rowlimit + ", rows=" + rows);
            if (rowlimit < 0) {
               continue;
            }
            else if (rows >= rowlimit) {
               break;
            }

            rows++;

            Element row = doc.createElement(rownode);

            for (int i = 1, j = columns; i <= j; i++) {
               int      cType = rsmd.getColumnType(i);
               columnName = rsmd.getColumnName(i);
               String   columnValue = "";

               switch (cType) {

               case Types.CHAR:
               case Types.VARCHAR:
               case Types.LONGVARCHAR:
                  columnValue = rs.getString(i);

                  break;

               case Types.DOUBLE:
                  columnValue = "" + rs.getDouble(i);

                  break;

               case Types.FLOAT:
                  columnValue = "" + rs.getFloat(i);

                  break;

               case Types.INTEGER:
                  columnValue = "" + rs.getInt(i);

                  break;

               case Types.NUMERIC:
                  columnValue = "" + rs.getLong(i);

                  break;

               case Types.DATE:
                  Date d = rs.getDate(i);
                  columnValue = (d==null) ? NULL_STR : d.toString();

                  break;

               case Types.TIMESTAMP:
                  Timestamp t = rs.getTimestamp(i);
                  columnValue = (t==null) ? NULL_STR : t.toString();

                  break;

               case Types.BIT:
               case Types.TINYINT:
               case Types.SMALLINT:
               case Types.BIGINT:
               case Types.REAL:
               case Types.DECIMAL:
               case Types.TIME:
               case Types.BINARY:
               case Types.VARBINARY:
               case Types.LONGVARBINARY:
               case Types.NULL:
               case Types.OTHER:
               case Types.JAVA_OBJECT:
               case Types.DISTINCT:
               case Types.STRUCT:
               case Types.ARRAY:
               case Types.BLOB:
               case Types.CLOB:
               case Types.REF:
               /* since JDK 1.4
               case Types.DATALINK:
               case Types.BOOLEAN:
               */
                  Object o1 = rs.getObject(i);
                  columnValue = (o1==null) ? NULL_STR : o1.toString();
                  break;

               default:
                  if (log.isLoggable(Level.FINE)) log.warning("Datatype '" + cType + "' of column '" + columnName + "' is not implemented, plase add a case statement in DBAdapterUtils.java");
                  Object o2 = rs.getObject(i);
                  columnValue = (o2==null) ? NULL_STR : o2.toString();
                  break;
               }

               if (log.isLoggable(Level.FINE)) log.fine("row="+ rows + ", columnName=" + columnName + ", type=" + cType + " columnValue='" + columnValue + "'");
               Element col = doc.createElement(columnName);
               CDATASection cvalue = doc.createCDATASection(columnValue);

               col.appendChild(cvalue);
               row.appendChild(col);
               results.appendChild(row);
            }
         }

         Element numRows = doc.createElement("rownum");
         Text        numRowsValue = doc.createTextNode("" + rows);
  
         numRows.appendChild(numRowsValue);
         desc.appendChild(numRows);
  
         doc.appendChild(root);
View Full Code Here

      Element root = (Element)document.createElement(descriptor.getDocumentrootnode());
      document.appendChild(root);
      Element row =  (Element)document.createElement(descriptor.getRowrootnode());
      root.appendChild(row);
      Text rows = (Text)document.createTextNode(rowsAffected + " row(s) were affected during the update.");
      row.appendChild(rows);
      return document;
   }
View Full Code Here

                final Configuration child = toConfiguration( (Element)node, childPath );
                configuration.addChild( child );
            }
            else if( node instanceof Text )
            {
                final Text data = (Text)node;
                if( null != content )
                {
                    content += data.getData();
                }
                else
                {
                    content = data.getData();
                }
            }
        }

        if( null != content )
View Full Code Here

        final Element element = document.createElement( configuration.getName() );

        final String content = configuration.getValue( null );
        if( null != content )
        {
            final Text child = document.createTextNode( content );
            element.appendChild( child );
        }

        final String[] names = configuration.getAttributeNames();
        for( int i = 0; i < names.length; i++ )
View Full Code Here

    doc.getDocumentElement().appendChild(statement);

    Element record = null;
    Element column = null;
    String data = null;
    Text columnData = null;

    try
    {
      ResultSetMetaData metadata = results.getMetaData();
      while (results.next())
View Full Code Here

TOP

Related Classes of org.w3c.dom.Text

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.