Package org.w3c.dom

Examples of org.w3c.dom.Comment


      }
      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


                fDeferredDocumentImpl.appendChild(fCurrentNodeIndex, comment);
            }

            // full node expansion
            else {
                Comment comment = fDocument.createComment(fStringPool.orphanString(dataIndex));
                fCurrentElementNode.appendChild(comment);
            }
        }

    } // comment(int)
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

        }
        if (!fIncludeComments || fFilterReject) {
              return;
        }
        if (!fDeferNodeExpansion) {
            Comment comment = fDocument.createComment(text.toString());

            setCharacterData(false);
            fCurrentNode.appendChild(comment);
            if (fDOMFilter !=null &&
                (fDOMFilter.getWhatToShow() & NodeFilter.SHOW_COMMENT)!= 0) {
View Full Code Here

                    Text v = (Text)node;
                    ps.print("TEXT:"); // $NON-NLS-1$
                    ps.print(" text='"+v.getData()+"'"); // $NON-NLS-1$
                } break;
                case Node.COMMENT_NODE: {
                    Comment v = (Comment)node;
                    ps.print("COMMENT:"); // $NON-NLS-1$
                    ps.print(" text='"+v.getData()+"'"); // $NON-NLS-1$
                } break;
                case Node.ENTITY_NODE: {
                    Entity v = (Entity)node;
                    ps.print("ENTITY:"); // $NON-NLS-1$
                } break;
View Full Code Here

        assertThat(doc.getInputEncoding(), is("UTF-8"));
    }

    @Test
    public void testInsertBefore() throws Exception {
        final Comment c1 = doc.createComment("1");
        final Comment c2 = doc.createComment("2");
        doc.appendChild(c2);
        doc.insertBefore(c1, c2);
        assertThat(doc.toString(), is("<!--1--><!--2-->"));
    }
View Full Code Here

        assertThat(doc.toString(), is("<!--1--><!--2-->"));
    }

    @Test
    public void testReplaceChild() throws Exception {
        final Comment c1 = doc.createComment("1");
        final Comment c2 = doc.createComment("2");
        doc.appendChild(c1);
        doc.replaceChild(c2, c1);
        assertThat(doc.toString(), is("<!--2-->"));
    }
View Full Code Here

    /**
     * Lexical Handler method to create comment node in DOM tree.
     */
    public void comment(char[] ch, int start, int length) {
        final Node last = nodeStk.peek();
        Comment comment = document.createComment(new String(ch, start, length));
        if (comment != null) {
            if (last == root && nextSibling != null) {
                last.insertBefore(comment, nextSibling);
            } else {
                last.appendChild(comment);
View Full Code Here

                stack.getFirst().appendChild(textNode);
            } else if (event == CDATA) {
                CDATASection cdataSection = document.createCDATASection(getText());
                stack.getFirst().appendChild(cdataSection);
            } else if (event == COMMENT) {
                Comment comment = document.createComment(getText());
                stack.getFirst().appendChild(comment);
            } else if (event == SPACE) {
            } else if (event == START_DOCUMENT) {
            } else if (event == END_DOCUMENT) {
            } else if (event == PROCESSING_INSTRUCTION) {
View Full Code Here

     */
    private void mergeTemplate(Element template, Element instance, int index) {
        if (template != null && instance != null) {
            if (index == 0) {
                //Process only if this is the first element of its kind
                Comment comment = YADOMUtil.getCommentBefore(template);
                if (comment != null
                    && comment.getTextContent().endsWith(OGNLUtils.SOAPUI_CLONE_COMMENT)) {
                    Node parent = instance.getParentNode();
                    if (parent != null) {
                        Comment newComment = parent.getOwnerDocument().createComment(comment.getTextContent());
                        parent.insertBefore(newComment, instance);
                    }
                }
            }

View Full Code Here

TOP

Related Classes of org.w3c.dom.Comment

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.