Search in sources :

Example 6 with OMDocType

use of org.apache.axiom.om.OMDocType in project webservices-axiom by apache.

the class DialectTest method testDTD.

/**
     * Tests that Axiom is able to read a DOCTYPE declaration. Since accessing the information in
     * the DOCTYPE declaration is not standardized by the StAX specification, this will fail if the
     * StAX dialect is not detected correctly.
     * 
     * @throws Exception
     */
@Test
public void testDTD() throws Exception {
    OMDocument document = OMXMLBuilderFactory.createOMBuilder(new StringReader("<!DOCTYPE root><root/>")).getDocument();
    OMDocType dtd = (OMDocType) document.getFirstOMChild();
    assertEquals("root", dtd.getRootName());
}
Also used : OMDocType(org.apache.axiom.om.OMDocType) StringReader(java.io.StringReader) OMDocument(org.apache.axiom.om.OMDocument) Test(org.junit.Test)

Aggregations

OMDocType (org.apache.axiom.om.OMDocType)6 Iterator (java.util.Iterator)2 OMDocument (org.apache.axiom.om.OMDocument)2 OMElement (org.apache.axiom.om.OMElement)2 OMNode (org.apache.axiom.om.OMNode)2 OMProcessingInstruction (org.apache.axiom.om.OMProcessingInstruction)2 InputStream (java.io.InputStream)1 StringReader (java.io.StringReader)1 XMLStreamWriter (javax.xml.stream.XMLStreamWriter)1 OMComment (org.apache.axiom.om.OMComment)1 OMNamespace (org.apache.axiom.om.OMNamespace)1 OMText (org.apache.axiom.om.OMText)1 OMXMLParserWrapper (org.apache.axiom.om.OMXMLParserWrapper)1 AxiomComment (org.apache.axiom.om.impl.intf.AxiomComment)1 AxiomDocType (org.apache.axiom.om.impl.intf.AxiomDocType)1 AxiomElement (org.apache.axiom.om.impl.intf.AxiomElement)1 AxiomEntityReference (org.apache.axiom.om.impl.intf.AxiomEntityReference)1 AxiomNamespaceDeclaration (org.apache.axiom.om.impl.intf.AxiomNamespaceDeclaration)1 AxiomProcessingInstruction (org.apache.axiom.om.impl.intf.AxiomProcessingInstruction)1 TextContent (org.apache.axiom.om.impl.intf.TextContent)1