Package org.w3c.dom

Examples of org.w3c.dom.Document.createComment()


        throws Exception
    {
        final Document document = createDocument();
        final String name = "meep";
        final Element element = document.createElement( name );
        final Comment comment = document.createComment( "comment" );
        element.appendChild( comment );
        final Configuration configuration = ConfigurationUtil.toConfiguration( element );

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


        else
          entity.appendChild(resultDocument.createTextNode(""));
        currentElement.appendChild(entity);
        break;
      case ParserInstruction.AddComment:
        Comment comment = resultDocument.createComment(domArgument);
        currentElement.appendChild(comment);
        break;
      case ParserInstruction.SetTitle:
        Element titleNode = createElementNS(resultDocument, currentNamespaceURI, "title");
        titleNode.appendChild(resultDocument.createTextNode(fixText(domArgument)));
View Full Code Here

      // build the XML in memory using DOM
      DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
      Document doc = builder.newDocument();

      // Add a comment
      Comment comment = doc.createComment(" automatically produced by XMLAttributePersistenceManager ");
      doc.appendChild(comment);
     
      // Insert root element
      Element root = doc.createElement(AL_ROOT_ELEMENT);
      root.setAttribute(AL_ID_ATTRIBUTE, origId);
View Full Code Here

                  // append the attribute to the attribute-list
                  root.appendChild(element);
               }
               else {
                  // could not serialize the object - write and log a warning
                  root.appendChild(doc.createComment(
                        " WARN <attribute name=\"" + name + "\" type=\"" + type +
                        "\"/> could not be serialized "));
                 
                  log.warn("Could not serialize attribute '" + name +
                           "' of type '" + type + "' and value: " + value);
View Full Code Here

                           "' of type '" + type + "' and value: " + value);
               }
          }
          else {
             // (e) could not find a way to persist - record and log a warning
             root.appendChild(doc.createComment(
                   " WARN <attribute name=\"" + name + "\" type=\"" + type +
                     "\"/> could not be persisted "));
            
             log.warn("Could not find a way to persist attribute '" + name +
                      "' of type '" + type + "' and value: " + value);
View Full Code Here

      // Sorted set with bundle archives, same bsn, different versions
      for (Iterator itV = bsnSet.iterator(); itV.hasNext();) {
        final BundleArchive ba = (BundleArchive) itV.next();

        dependencies.appendChild(doc.createTextNode("\n\n" +prefix2));
        dependencies.appendChild(doc.createComment(ba.relPath));
        dependencies.appendChild(doc.createTextNode("\n" +prefix2));

        final Element dependency = doc.createElement("dependency");
        dependencies.appendChild(dependency);
View Full Code Here

      for (Iterator itV = bsnSet.iterator(); itV.hasNext();) {
        final BundleArchive ba = (BundleArchive) itV.next();
        final String targetName = ba.bsn + "-" + ba.version;
        targetNames.append(",").append(targetName);

        final Comment comment = doc.createComment(ba.relPath);
        final Element target = doc.createElement("target");
        target.setAttribute("name", targetName);

        final Element mvnDeployBundle = doc.createElement("mvn_deploy_bundle");
        target.appendChild(doc.createTextNode("\n"+prefix2));
View Full Code Here

                case Node.CDATA_SECTION_NODE: {
                    node = factory.createCDATASection(place.getNodeValue());
                    break;
                }
                case Node.COMMENT_NODE: {
                    node = factory.createComment(place.getNodeValue());
                    break;
                }
                case Node.ELEMENT_NODE: {
                    Element element = factory.createElement(place.getNodeName());
                    node = element;
View Full Code Here

                }

                break;
            case XMLStreamConstants.COMMENT:
                if (parent != null) {
                    parent.appendChild(doc.createComment(reader.getText()));
                }

                break;
            case XMLStreamConstants.CDATA:
                parent.appendChild(doc.createCDATASection(reader.getText()));
View Full Code Here

    protected final void runTest() throws Throwable {
        Document doc = dbf.newDocumentBuilder().newDocument();
        Element newChild = doc.createElementNS(null, "newChild");
        if (newChildHasSiblings) {
            Element parent = doc.createElementNS(null, "parent");
            parent.appendChild(doc.createComment("previous sibling"));
            parent.appendChild(newChild);
            parent.appendChild(doc.createComment("next sibling"));
        }
        runTest(doc, newChild);
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.