Search in sources :

Example 71 with DocumentType

use of org.w3c.dom.DocumentType in project webservices-axiom by apache.

the class TestWithParser1 method runTest.

protected void runTest() throws Throwable {
    Document document = dbf.newDocumentBuilder().parse(TestWithParser1.class.getResource("test1.xml").toString());
    DocumentType doctype = document.getDoctype();
    assertEquals("root", doctype.getName());
    assertNull(doctype.getPublicId());
    assertNull(doctype.getSystemId());
    assertEquals("<!ELEMENT root (#PCDATA)>", doctype.getInternalSubset().trim());
}
Also used : DocumentType(org.w3c.dom.DocumentType) Document(org.w3c.dom.Document)

Example 72 with DocumentType

use of org.w3c.dom.DocumentType in project webservices-axiom by apache.

the class TestWithParser2 method runTest.

protected void runTest() throws Throwable {
    Document document = dbf.newDocumentBuilder().parse(TestWithParser2.class.getResource("test2.xml").toString());
    DocumentType doctype = document.getDoctype();
    assertEquals("root", doctype.getName());
    assertEquals("dummy", doctype.getPublicId());
    assertEquals("test.dtd", doctype.getSystemId());
    assertNull(doctype.getInternalSubset());
}
Also used : DocumentType(org.w3c.dom.DocumentType) Document(org.w3c.dom.Document)

Aggregations

DocumentType (org.w3c.dom.DocumentType)72 Document (org.w3c.dom.Document)56 DOMImplementation (org.w3c.dom.DOMImplementation)28 DOMException (org.w3c.dom.DOMException)18 NamedNodeMap (org.w3c.dom.NamedNodeMap)12 Node (org.w3c.dom.Node)12 Element (org.w3c.dom.Element)11 NodeList (org.w3c.dom.NodeList)8 ArrayList (java.util.ArrayList)7 Entity (org.w3c.dom.Entity)7 IOException (java.io.IOException)5 Attr (org.w3c.dom.Attr)4 Text (org.w3c.dom.Text)4 SAXParseException (org.xml.sax.SAXParseException)4 URL (java.net.URL)3 URLConnection (java.net.URLConnection)3 DocumentBuilder (javax.xml.parsers.DocumentBuilder)3 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)3 DocumentImpl (org.apache.harmony.xml.dom.DocumentImpl)3 XMLString (org.apache.xml.utils.XMLString)3