Package org.jdom2

Examples of org.jdom2.Document.addContent()


    DocType dt = new DocType("root");
    Comment comment = new Comment("comment");
    ProcessingInstruction pi = new ProcessingInstruction("jdomtest", "");
    Element root = new Element("root");
    Document doc = new Document();
    doc.addContent(dt);
    doc.addContent(comment);
    doc.addContent(pi);
    doc.addContent(root);
    String xmldec = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
    String dtdec = "<!DOCTYPE root>";
View Full Code Here


    Comment comment = new Comment("comment");
    ProcessingInstruction pi = new ProcessingInstruction("jdomtest", "");
    Element root = new Element("root");
    Document doc = new Document();
    doc.addContent(dt);
    doc.addContent(comment);
    doc.addContent(pi);
    doc.addContent(root);
    String xmldec = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
    String dtdec = "<!DOCTYPE root>";
    String commentdec = "<!--comment-->";
View Full Code Here

    ProcessingInstruction pi = new ProcessingInstruction("jdomtest", "");
    Element root = new Element("root");
    Document doc = new Document();
    doc.addContent(dt);
    doc.addContent(comment);
    doc.addContent(pi);
    doc.addContent(root);
    String xmldec = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
    String dtdec = "<!DOCTYPE root>";
    String commentdec = "<!--comment-->";
    String pidec = "<?jdomtest?>";
View Full Code Here

    Element root = new Element("root");
    Document doc = new Document();
    doc.addContent(dt);
    doc.addContent(comment);
    doc.addContent(pi);
    doc.addContent(root);
    String xmldec = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
    String dtdec = "<!DOCTYPE root>";
    String commentdec = "<!--comment-->";
    String pidec = "<?jdomtest?>";
    String rtdec = "<root />";
View Full Code Here

  public void testDeepNesting() {
    // need to get beyond 16 levels of XML.
    DocType dt = new DocType("root");
    Element root = new Element("root");
    Document doc = new Document();
    doc.addContent(dt);
    doc.addContent(root);
    String xmldec = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
    String dtdec = "<!DOCTYPE root>";
    String lf = "\n";
   
View Full Code Here

          }
        } else if (event instanceof javax.xml.stream.events.Comment) {
          final Comment comment = factory.comment(
              ((javax.xml.stream.events.Comment)event).getText());
          if (current == null) {
            document.addContent(comment);
          } else {
            current.addContent(comment);
          }
        } else if (event.isEntityReference()) {
          current.addContent(factory.entityRef(
View Full Code Here

        } else if (event.isProcessingInstruction()) {
          final ProcessingInstruction pi = factory.processingInstruction(
              ((javax.xml.stream.events.ProcessingInstruction)event).getTarget(),
              ((javax.xml.stream.events.ProcessingInstruction)event).getData());
          if (current == null) {
            document.addContent(pi);
          } else {
            current.addContent(pi);
          }
        } else if (event.isEndElement()) {
          current = current.getParentElement();
View Full Code Here

    // need to get beyond 16 levels of XML.
    DocType dt = new DocType("root");
    Element root = new Element("root");
    Document doc = new Document();
    doc.addContent(dt);
    doc.addContent(root);
    String xmldec = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
    String dtdec = "<!DOCTYPE root>";
    String lf = "\n";
   
    StringBuilder raw = new StringBuilder();
View Full Code Here

            throw new JDOMException("Unexpected XMLStream event at Document level: SPACE");
          case CHARACTERS:
            throw new JDOMException("Unexpected XMLStream event at Document level: CHARACTERS");

          case COMMENT:
            document.addContent(
                factory.comment(stream.getText()));
            break;

          case PROCESSING_INSTRUCTION:
            document.addContent(factory.processingInstruction(
View Full Code Here

            document.addContent(
                factory.comment(stream.getText()));
            break;

          case PROCESSING_INSTRUCTION:
            document.addContent(factory.processingInstruction(
                stream.getPITarget(), stream.getPIData()));
            break;

          default:
            throw new JDOMException("Unexpected XMLStream event " + state);
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.