Package org.w3c.dom

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


            container.addTextNode(nodeValue);
         }
         else if (childType == Node.COMMENT_NODE)
         {
            String nodeValue = child.getNodeValue();
            Comment comment = ownerDoc.createComment(nodeValue);
            container.appendChild(comment);
         }
         else if (childType == Node.CDATA_SECTION_NODE)
         {
            String nodeValue = child.getNodeValue();
View Full Code Here


  {
    Document document = element.getOwnerDocument();
    for (int i = 0; i < lines.length; ++i)
    {
//      element.appendChild(document.createTextNode("\n"));
      element.appendChild(document.createComment(lines[i]));
    }
//    element.appendChild(document.createTextNode("\n"));
  }

  private void tagTemplate(Element element)
View Full Code Here

            }
          }
        }
        if (!inserted) {
          myWebXML.getDocumentElement().appendChild(
              myWebXML.createComment(ONPOSITIVE_COMMENTS_MARK));
          myWebXML.getDocumentElement().appendChild(
              myWebXML.createTextNode("\n"));
          for (Element e : toAppend) {
            Node adoptNode = myWebXML.adoptNode(e.cloneNode(true));
            myWebXML.getDocumentElement().appendChild(adoptNode);
View Full Code Here

  {
    Document document = element.getOwnerDocument();
    for (int i = 0; i < lines.length; ++i)
    {
//      element.appendChild(document.createTextNode("\n"));
      element.appendChild(document.createComment(lines[i]));
    }
//    element.appendChild(document.createTextNode("\n"));
  }

  private void tagTemplate(Element element)
View Full Code Here

      }
      Element propNode = doc.createElement("property");
      conf.appendChild(propNode);

      if (updatingResource != null) {
        Comment commentNode = doc.createComment(
          "Loaded from " + updatingResource.get(name));
        propNode.appendChild(commentNode);
      }
      Element nameNode = doc.createElement("name");
      nameNode.appendChild(doc.createTextNode(name));
View Full Code Here

    public void testCommentNode() throws Exception {
        //CXF-3034
        Document document = DocumentBuilderFactory.newInstance()
            .newDocumentBuilder().newDocument();
        Element root = document.createElementNS("urn:test", "root");
        root.appendChild(document.createComment("test comment"));
        StaxUtils.copy(StaxUtils.createXMLStreamReader(root), StaxUtils.createXMLStreamWriter(System.out));
    }
    @Test
    public void testToNextElement() {
        String soapMessage = "./resources/sayHiRpcLiteralReq.xml";
View Full Code Here

                    break;
                case CHARACTERS:
                    current.appendChild(document.createTextNode(reader.getText()));
                    break;
                case COMMENT:
                    current.appendChild(document.createComment(reader.getText()));
                    break;
                case END_ELEMENT:
                    // pop the element off the stack
                    current = current.getParentNode();
                    // if we are back at the root then we are done
View Full Code Here

        Document signedDoc = builder.build(doc, crypto, secHeader);
       
        // Add a comment node as the first node element
        org.w3c.dom.Node firstChild = signedDoc.getFirstChild();
        org.w3c.dom.Node newNode = signedDoc.removeChild(firstChild);
        org.w3c.dom.Node commentNode = signedDoc.createComment("This is a comment");
        signedDoc.appendChild(commentNode);
        signedDoc.appendChild(newNode);

        if (LOG.isDebugEnabled()) {
            LOG.debug("After Signing....");
View Full Code Here

    public void testAllowedChildren() throws Exception {
        DOMTestUtil.execute(new DOMTestUtil.Test() {
            public void execute(DocumentBuilderFactory dbf) throws Exception {
                Document doc = dbf.newDocumentBuilder().newDocument();
               
                doc.appendChild(doc.createComment("some comment"));
                doc.appendChild(doc.createProcessingInstruction("pi", "data"));
               
                // Document Object Model (DOM) Level 3 Core Specification, section 1.1.1
                // says that text nodes are not allowed as children of a document.
                try {
View Full Code Here

                    assertEquals(DOMException.HIERARCHY_REQUEST_ERR, ex.code);
                }
               
                // PIs and comments after the document element are allowed
                doc.appendChild(doc.createProcessingInstruction("pi", "data"));
                doc.appendChild(doc.createComment("some comment"));
               
                // Again, text nodes are not allowed
                try {
                    doc.appendChild(doc.createTextNode("    "));
                    fail("Expected DOMException");
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.