Package org.apache.axiom.om

Examples of org.apache.axiom.om.OMComment


        OMDocument omdoc = (OMDocument)doc;
        for (Iterator i = getChildren(); i.hasNext();) {
            OMNode node = (OMNode)i.next();
            switch (node.getType()) {
                case OMNode.COMMENT_NODE:
                    OMComment comment = (OMComment)node;
                    factory.createOMComment(omdoc, comment.getValue());
                    break;
                // TODO: Decide what to do with this code; it will no longer work in Axiom 1.2.14 (because of AXIOM-437).
                //       On the other hand, since we filter out DTDs, this code is never triggered.
//                case OMNode.DTD_NODE:
//                    OMDocType doctype = (OMDocType)node;
View Full Code Here


        }
        return this;
    }

    public <X extends Base> X addComment(String value) {
        OMComment comment = this.factory.createOMComment(null, value);
        if (this.getOMDocumentElement() != null) {
            this.getOMDocumentElement().insertSiblingBefore(comment);
        } else {
            this.addChild(comment);
        }
View Full Code Here

    OMDocument omdoc = (OMDocument) doc;
    for (Iterator i = getChildren(); i.hasNext();) {
      OMNode node = (OMNode) i.next();
      switch(node.getType()) {
        case OMNode.COMMENT_NODE:
          OMComment comment = (OMComment) node;
          factory.createOMComment(omdoc, comment.getValue());
          break;
        case OMNode.DTD_NODE:
          OMDocType doctype = (OMDocType) node;
          factory.createOMDocType(omdoc, doctype.getValue());
          break;
View Full Code Here

    }
    return this;
  }

  public <X extends Base>X addComment(String value) {
    OMComment comment =
      this.factory.createOMComment(null, value);
    if (this.getOMDocumentElement() != null) {
      this.getOMDocumentElement().insertSiblingBefore(comment);
    } else {
      this.addChild(comment);
View Full Code Here

        factory.createOMText(dest,text.getText(), OMNode.CDATA_SECTION_NODE);
      } else if (node.getType() == OMNode.TEXT_NODE) {
        OMText text = (OMText) node;
        factory.createOMText(dest,text.getText());
      } else if (node.getType() == OMNode.COMMENT_NODE) {
        OMComment comment = (OMComment) node;
        factory.createOMComment(dest, comment.getValue());
      } else if (node.getType() == OMNode.PI_NODE) {
        OMProcessingInstruction pi = (OMProcessingInstruction) node;
        factory.createOMProcessingInstruction(dest, pi.getTarget(), pi.getValue());
      } else if (node.getType() == OMNode.SPACE_NODE) {
        OMText text = (OMText) node;
View Full Code Here

    }

    protected void runTest() throws Throwable {
        OMFactory factory = metaFactory.getOMFactory();
        OMDocument document = factory.createOMDocument();
        OMComment comment = factory.createOMComment(document, "some comment");
        OMElement documentElement = factory.createOMElement("root", null);
        document.setOMDocumentElement(documentElement);
        assertSame(documentElement, document.getOMDocumentElement());
        assertSame(document, documentElement.getParent());
        Iterator it = document.getChildren();
View Full Code Here

    public TestCreateOMCommentWithoutParent(OMMetaFactory metaFactory) {
        super(metaFactory);
    }

    protected void runTest() throws Throwable {
        OMComment comment = metaFactory.getOMFactory().createOMComment(null, "my comment");
        assertNull(comment.getParent());
        assertEquals("my comment", comment.getValue());
    }
View Full Code Here

          .createOMProcessingInstruction(this,
              importedPI.getTarget(), importedPI.getValue());
      return newPI;
    }
    case (OMNode.COMMENT_NODE): {
      OMComment importedComment = (OMComment) child;
      OMComment newComment = this.factory.createOMComment(this,
          importedComment.getValue());
      DocumentImpl doc;
      if (this instanceof DocumentImpl) {
        doc = (DocumentImpl) this;
      } else {
View Full Code Here

      OMFactory llomFactory = OMAbstractFactory.getOMFactory();
      String text = "This was a DOOM Text";
     
      OMElement doomRoot = doomFactory.createOMElement("root",null);
      OMText llomText = llomFactory.createOMText(text);
      OMComment comment = llomFactory.createOMComment(null,"comment");
      doomRoot.addChild(llomText);
      doomRoot.addChild(comment);
     
      OMElement newElement = (new StAXOMBuilder(this.factory, doomRoot
        .getXMLStreamReader())).getDocumentElement();
View Full Code Here

                                                       importedPI.getTarget(),
                                                       importedPI.getValue());
                return newPI;
            }
            case (OMNode.COMMENT_NODE): {
                OMComment importedComment = (OMComment) child;
                OMComment newComment = this.factory.createOMComment(this,
                                                                    importedComment.getValue());
                DocumentImpl doc;
                if (this instanceof DocumentImpl) {
                    doc = (DocumentImpl) this;
                } else {
View Full Code Here

TOP

Related Classes of org.apache.axiom.om.OMComment

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.