Package org.jdom2

Examples of org.jdom2.DocType


  }
 
  @Test
  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\"?>";
View Full Code Here


          //            document.setProperty("ENCODING",
          //                ((StartDocument)event).getEncoding());
        } else if (event instanceof javax.xml.stream.events.DTD) {
          //List<?> list = (List<?>)reader.getProperty("javax.xml.stream.entities");
          //System.out.println(list);
          final DocType dtype = DTDParser.parse(((javax.xml.stream.events.DTD)event).getDocumentTypeDeclaration(), factory);
          document.setDocType(dtype);
        } else if (event.isStartElement()) {
          final Element emt = processElement(factory, event.asStartElement());
          if (current == null) {
            document.setRootElement(emt);
            final DocType dt = document.getDocType();
            if (dt != null) {
              dt.setElementName(emt.getName());
            }
          } else {
            current.addContent(emt);
          }
          current = emt;
View Full Code Here

        super(type,version);
    }

    protected Document createDocument(Element root) {
        Document doc = new Document(root);
        DocType docType = new DocType(RSS091NetscapeParser.ELEMENT_NAME,
                                      RSS091NetscapeParser.PUBLIC_ID,
                                      RSS091NetscapeParser.SYSTEM_ID);
        doc.setDocType(docType);
        return doc;
    }
View Full Code Here

    public Api2XmlConverter()
    {
        xmlOutputter = new XMLOutputter();
        doc = new Document();
        doc.setDocType(new DocType("xml"));
        doc.setProperty("version", "1.0");
        doc.setProperty("encoding", "UTF-8");
    }
View Full Code Here

    public Api1XmlConverter()
    {
        xmlOutputter = new XMLOutputter();
        doc = new Document();
        doc.setDocType(new DocType("xml"));
        doc.setProperty("version", "1.0");
        doc.setProperty("encoding", "UTF-8");
    }
View Full Code Here

    }

    @Override
    protected Document createDocument(final Element root) {
        final Document doc = new Document(root);
        final DocType docType = new DocType(RSS091NetscapeParser.ELEMENT_NAME, RSS091NetscapeParser.PUBLIC_ID, RSS091NetscapeParser.SYSTEM_ID);
        doc.setDocType(docType);
        return doc;
    }
View Full Code Here

    public boolean isMyType(final Document document) {

        final Element rssRoot = document.getRootElement();
        final String name = rssRoot.getName();
        final Attribute version = rssRoot.getAttribute("version");
        final DocType docType = document.getDocType();

        return name.equals(ELEMENT_NAME) && version != null && version.getValue().equals(getRSSVersion()) && docType != null
                && ELEMENT_NAME.equals(docType.getElementName()) && PUBLIC_ID.equals(docType.getPublicID()) && SYSTEM_ID.equals(docType.getSystemID());

    }
View Full Code Here

            DOMBuilder domBuilder = new DOMBuilder();
            if (node.getNodeType() == Node.ELEMENT_NODE) {
                return domBuilder.build((org.w3c.dom.Element) node);
            }
            else if (node.getNodeType() == Node.DOCUMENT_NODE) {
                Document document = domBuilder.build((org.w3c.dom.Document) node);
                return document.getRootElement();
            }
        }
        // we have no other option than to transform
        JDOMResult jdomResult = new JDOMResult();
        transform(requestPayload, jdomResult);
View Full Code Here

            DOMBuilder domBuilder = new DOMBuilder();
            if (node.getNodeType() == Node.ELEMENT_NODE) {
                return domBuilder.build((org.w3c.dom.Element) node);
            }
            else if (node.getNodeType() == Node.DOCUMENT_NODE) {
                Document document = domBuilder.build((org.w3c.dom.Document) node);
                return document.getRootElement();
            }
        }
        // we have no other option than to transform
        JDOMResult jdomResult = new JDOMResult();
        transform(source, jdomResult);
View Full Code Here

            return revisionTimestamp;
        }

        public ParsePage invoke() throws JDOMException, IOException {
            SAXBuilder builder = new SAXBuilder();
            Document doc = builder.build(new ByteArrayInputStream(pageString.getBytes()));
            pageTitle = textToString(titleXPath.evaluateFirst(doc));
            wikitext = textToString(textXPath.evaluate(doc));
            sourceUrl = "http://en.wikipedia.org/wiki/" + pageTitle;
            String revisionTimestampString = textToString(revisionTimestampXPath.evaluateFirst(doc));
            revisionTimestamp = null;
View Full Code Here

TOP

Related Classes of org.jdom2.DocType

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.