Search in sources :

Example 16 with OMDocument

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

the class TestGetOMDocumentElementAfterDetach method runTest.

@Override
protected void runTest() throws Throwable {
    OMFactory factory = metaFactory.getOMFactory();
    OMDocument document = factory.createOMDocument();
    OMElement documentElement = factory.createOMElement("root", null, document);
    assertSame(documentElement, document.getOMDocumentElement());
    documentElement.detach();
    assertNull(document.getOMDocumentElement());
}
Also used : OMFactory(org.apache.axiom.om.OMFactory) OMElement(org.apache.axiom.om.OMElement) OMDocument(org.apache.axiom.om.OMDocument)

Example 17 with OMDocument

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

the class TestSetOMDocumentElementNull method runTest.

@Override
protected void runTest() throws Throwable {
    OMFactory factory = metaFactory.getOMFactory();
    OMDocument document = factory.createOMDocument();
    try {
        document.setOMDocumentElement(null);
        fail("Expected IllegalArgumentException");
    } catch (IllegalArgumentException ex) {
    // Expected
    }
}
Also used : OMFactory(org.apache.axiom.om.OMFactory) OMDocument(org.apache.axiom.om.OMDocument)

Example 18 with OMDocument

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

the class TestImportInformationItem method runTest.

@Override
protected void runTest() throws Throwable {
    OMDocument original = file.getAdapter(XMLSampleAdapter.class).getDocument(metaFactory);
    assertAbout(xml()).that(xml(OMDocument.class, (OMDocument) metaFactory.getOMFactory().importInformationItem(original))).hasSameContentAs(xml(OMDocument.class, original));
}
Also used : XMLSampleAdapter(org.apache.axiom.ts.om.XMLSampleAdapter) OMDocument(org.apache.axiom.om.OMDocument)

Example 19 with OMDocument

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

the class TestDetach method runTest.

@Override
protected void runTest(SOAPEnvelope envelope) throws Throwable {
    OMDocument document = (OMDocument) envelope.getParent();
    envelope.detach();
    assertNull(envelope.getParent());
    assertNull(envelope.getPreviousOMSibling());
    assertNull(envelope.getNextOMSibling());
    assertNull(document.getOMDocumentElement());
}
Also used : OMDocument(org.apache.axiom.om.OMDocument)

Example 20 with OMDocument

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

the class TestCreateOMDocument method runTest.

@Override
protected void runTest() throws Throwable {
    OMDocument document = metaFactory.getOMFactory().createOMDocument();
    assertNotNull(document);
    assertNull(document.getFirstOMChild());
    // OMDocument doesn't extend OMNode. Therefore, the OMDocument implementation
    // should not implement OMNode either. This is a regression test for AXIOM-385.
    assertFalse(document instanceof OMNode);
}
Also used : OMNode(org.apache.axiom.om.OMNode) OMDocument(org.apache.axiom.om.OMDocument)

Aggregations

OMDocument (org.apache.axiom.om.OMDocument)51 OMElement (org.apache.axiom.om.OMElement)19 OMFactory (org.apache.axiom.om.OMFactory)18 StringReader (java.io.StringReader)13 OMNode (org.apache.axiom.om.OMNode)9 ByteArrayOutputStream (java.io.ByteArrayOutputStream)5 Document (org.w3c.dom.Document)5 StringWriter (java.io.StringWriter)4 XMLStreamReader (javax.xml.stream.XMLStreamReader)4 InputStream (java.io.InputStream)3 ArrayList (java.util.ArrayList)3 OMCloneOptions (org.apache.axiom.om.OMCloneOptions)3 OMInformationItem (org.apache.axiom.om.OMInformationItem)3 OMNamespace (org.apache.axiom.om.OMNamespace)3 OMXMLParserWrapper (org.apache.axiom.om.OMXMLParserWrapper)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 Transformer (javax.xml.transform.Transformer)2 DTDReader (org.apache.axiom.ext.stax.DTDReader)2 OMAttribute (org.apache.axiom.om.OMAttribute)2 OMComment (org.apache.axiom.om.OMComment)2