Package org.apache.axiom.om

Examples of org.apache.axiom.om.OMElement.addChild()


    protected void runTest() throws Throwable {
        OMElement parent = soapFactory.createOMElement("parent", null);
        SOAPFault fault = soapFactory.createSOAPFault();
        try {
            parent.addChild(fault);
            fail("Expected SOAPProcessingException");
        } catch (SOAPProcessingException ex) {
            // Expected
        }
    }
View Full Code Here


        OMElement root = factory.createOMElement("root", ns1);
        OMNamespace ns2 = root.declareNamespace("bar", "y");
        OMElement elt1 = factory.createOMElement("foo", ns1);
        OMElement elt2 = factory.createOMElement("yuck", ns2);
        OMText txt1 = factory.createOMText(elt2, "blah");
        elt2.addChild(txt1);
        elt1.addChild(elt2);
        root.addChild(elt1);
        root.serialize(writer);
    }
View Full Code Here

        OMText textData = fac.createOMText(dataHandler, false);

        envelope.addChild(body);
        body.addChild(data);
        data.addChild(text);
        text.addChild(textData);
    }

    public void testComplete() throws Exception {
        OMOutputFormat mtomOutputFormat = new OMOutputFormat();
        mtomOutputFormat.setDoOptimize(true);
View Full Code Here

        OMFactory factory = metaFactory.getOMFactory();
        OMElement element1 = factory.createOMElement("test1", null);
        OMElement element2 = factory.createOMElement("test2", null);
        OMText text = factory.createOMText("test");
        element1.addChild(text);
        element2.addChild(text);
        assertSame(element2, text.getParent());
        assertNull(element1.getFirstOMChild());
        assertSame(text, element2.getFirstOMChild());
    }
}
View Full Code Here

        OMNamespace rootNS = f.createOMNamespace("http://sampleroot", "rootPrefix");
        OMNamespace ns = f.createOMNamespace("http://DUMMYNS", "DUMMYPREFIX");
        OMElement element =
                f.createOMElement(new TestDataSource(testDocument), "DUMMYNAME", ns);
        OMElement root = f.createOMElement("root", rootNS);
        root.addChild(element);

        // Test getting the namespace, localpart and prefix.  This should used not result in expansion
        assertTrue(element.getLocalName().equals("DUMMYNAME"));
        assertTrue(element.getNamespace().getNamespaceURI().equals("http://DUMMYNS"));
        assertTrue(element.getNamespace().getPrefix().equals("DUMMYPREFIX"));
View Full Code Here

        OMNamespace rootNS = f.createOMNamespace("http://sampleroot", "rootPrefix");
        OMNamespace ns = f.createOMNamespace("http://www.sosnoski.com/uwjws/library", "");
        OMElement element =
                f.createOMElement(new TestDataSource(testDocument2), "library", ns);
        OMElement root = f.createOMElement("root", rootNS);
        root.addChild(element);

        // Test getting the namespace, localpart and prefix.  This should used not result in expansion
        assertTrue(element.getLocalName().equals("library"));
        assertTrue(element.getNamespace().getNamespaceURI().equals(
                "http://www.sosnoski.com/uwjws/library"));
View Full Code Here

        // Trigger expansion of the child OMSE
        // This will cause the child to be partially parsed (i.e. incomplete)
        child.getChildren();
       
        // Add the child OMSE to the root.
        root.addChild(child);
       
        // Normally adding an incomplete child to a parent will
        // cause the parent to be marked as incomplete.
        // But OMSE's are self-contained...therefore the root
        // should still be complete
View Full Code Here

        // Now repeat the test, but this time trigger the
        // partial parsing of the child after adding it to the root.
        child = f.createOMElement(new TestDataSource(testDocument), "library", ns);
        root = f.createOMElement("root", rootNS);
       
        root.addChild(child);
        child.getChildren(); // causes partial parsing...i.e. incomplete child
   
        assertTrue(!child.isComplete());
        assertTrue(root.isComplete());
    }
View Full Code Here

        OMNamespace rootNS = f.createOMNamespace("http://sampleroot", "rootPrefix");
        OMNamespace ns = f.createOMNamespace("", "");
        OMElement element =
                f.createOMElement(new TestDataSource(testDocument3), "library", ns);
        OMElement root = f.createOMElement("root", rootNS);
        root.addChild(element);

        // Test getting the namespace, localpart and prefix.  This should used not result in expansion
        assertTrue(element.getLocalName().equals("library"));
        assertNull(element.getNamespace());
View Full Code Here

        OMFactory factory = metaFactory.getOMFactory();
        OMElement incompleteElement = OMXMLBuilderFactory.createOMBuilder(factory,
                new StringReader("<elem>text</elem>")).getDocumentElement(true);
        OMElement root = factory.createOMElement("root", null);
        OMElement child = factory.createOMElement("child", null, root);
        child.addChild(incompleteElement);
        StringWriter out = new StringWriter();
        root.serializeAndConsume(out);
        assertEquals("<root><child><elem>text</elem></child></root>", out.toString());
        assertConsumed(incompleteElement);
    }
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.