Package org.apache.axiom.om

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


    protected void runTest() throws Throwable {
        OMFactory factory = metaFactory.getOMFactory();
        OMElement element = factory.createOMElement("test", null);
        OMText text = factory.createOMText("test");
        element.addChild(text);
        assertSame(element, text.getParent());
        assertSame(text, element.getFirstOMChild());
    }
}
View Full Code Here


        OMNamespace namespace = factory.createOMNamespace(ns, "tst");

        String ln = "Child";

        OMElement bodyChild = factory.createOMElement(ln, namespace);
        bodyChild.addChild(factory.createOMText(value));

        envelope.getBody().addChild(bodyChild);


        ByteArrayOutputStream byteOutStr = new ByteArrayOutputStream();
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);
        assertTrue(root.isComplete());
        root.addChild(incompleteElement);
        assertFalse(root.isComplete());
    }
}
View Full Code Here

    protected void runTest() throws Throwable {
        OMFactory omfactory = metaFactory.getOMFactory();
        OMElement element = omfactory.createOMElement("test", null);
        OMText cdata = omfactory.createOMText("hello world", OMNode.CDATA_SECTION_NODE);
        element.addChild(cdata);
       
        // Get the XMLStreamReader for the element. This will return an OMStAXWrapper.
        XMLStreamReader reader2 = element.getXMLStreamReader();
        // Check the sequence of events
        int event = reader2.next();
View Full Code Here

        SOAPFactory llomFac = OMAbstractFactory.getMetaFactory(OMAbstractFactory.FEATURE_DOM).getSOAP11Factory();
        OMElement elem = llomFac.createOMElement("newDomElement", null);

        OMElement firstElement = env.getBody().getFirstElement();
        firstElement.addChild(elem);

        assertTrue("New DOM child missing",
                   env.toString().indexOf("newDomElement") > 0);
    }
}
View Full Code Here

        OMNamespace ns = factory.createOMNamespace("urn://sample", "my");
        OMElement om = factory.createOMElement(peds, "payload", ns);
       
        QName rootQName = new QName("urn://root", "root", "pre");
        OMElement root = factory.createOMElement(rootQName);
        root.addChild(om);
       
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
       
        // Apply the scenario
        if (scenario == Scenario.SER) {
View Full Code Here

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

        // Test getting the local name and namespace URI. 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

    protected void runTest() throws Throwable {
        OMFactory factory = metaFactory.getOMFactory();
        OMSourcedElement omse = factory.createOMElement(new ByteArrayDataSource("<sourcedelement/>".getBytes("utf-8"), "utf-8"));
        OMElement parent = factory.createOMElement(new QName("parent"));
        parent.addChild(omse);
        // Cause expansion of the sourced element without building it completely
        omse.getLocalName();
        assertTrue(omse.isExpanded());
        assertFalse(omse.isComplete());
        // Call getNextOMSibling(); this should not build the element
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

    protected void runTest() throws Throwable {
        OMElement parent = soapFactory.createOMElement("parent", null);
        SOAPHeaderBlock hb = soapFactory.createSOAPHeaderBlock("MyHeader", soapFactory.createOMNamespace("urn:test", "p"));
        try {
            parent.addChild(hb);
            fail("Expected SOAPProcessingException");
        } catch (SOAPProcessingException ex) {
            // Expected
        }
    }
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.