Examples of createOMNamespace()


Examples of org.apache.axiom.om.OMFactory.createOMNamespace()

    }

    protected void runTest() throws Throwable {
        OMFactory factory = metaFactory.getOMFactory();
        OMElement element = factory.createOMElement(new QName("test"));
        OMNamespace ns = factory.createOMNamespace("urn:ns", "p");
        element.declareNamespace(ns);
        OMAttribute att = factory.createOMAttribute("test", ns, "test");
        element.addAttribute(att);
        Iterator it = element.getAllDeclaredNamespaces();
        assertTrue(it.hasNext());
View Full Code Here

Examples of org.apache.axiom.om.OMFactory.createOMNamespace()

    private String addAttributeMethod1(String xmlString) throws Exception {
        OMXMLParserWrapper builder2 = OMXMLBuilderFactory.createOMBuilder(new StringReader(xmlString));
        OMElement doc = builder2.getDocumentElement();

        OMFactory factory = OMAbstractFactory.getOMFactory();
        OMNamespace ns = factory.createOMNamespace("http://www.me.com", "axiom");

        //code line to be tested
        OMAttribute at = factory.createOMAttribute("id", ns, "value");
        doc.addAttribute(at);
View Full Code Here

Examples of org.apache.axiom.om.OMFactory.createOMNamespace()

    private String addAttributeMethod2(String xmlString) throws Exception {
        OMXMLParserWrapper builder2 = OMXMLBuilderFactory.createOMBuilder(new StringReader(xmlString));
        OMElement doc = builder2.getDocumentElement();

        OMFactory factory = OMAbstractFactory.getOMFactory();
        OMNamespace ns = factory.createOMNamespace("http://www.me.com", "axiom");

        //code line to be tested
        doc.addAttribute("id", "value", ns);

        return doc.toString();
View Full Code Here

Examples of org.apache.axiom.om.OMFactory.createOMNamespace()

public class OMAttributeHelperTest extends TestCase {

    public void testImportOMAttribute() {
        //Convert from OM to DOOM.
        OMFactory omf = OMAbstractFactory.getOMFactory();
        OMNamespace ns1 = omf.createOMNamespace("http://nsurl", "prefix");
        OMAttribute attr1 = omf.createOMAttribute("attr1", ns1, "attr1value");

        OMFactory doomf = OMAbstractFactory.getMetaFactory(OMAbstractFactory.FEATURE_DOM).getOMFactory();
        OMElement ome1 = doomf.createOMElement("element", ns1.getNamespaceURI(), ns1.getPrefix());
        AttributeHelper.importOMAttribute(attr1, ome1);
View Full Code Here

Examples of org.apache.axiom.om.OMFactory.createOMNamespace()

        assertNotSame(attr1, ome1.getAttribute(attr1.getQName()));
        assertEquals(attr1.getAttributeValue(),
                     ome1.getAttribute(attr1.getQName()).getAttributeValue());

        //Convert from DOOM to OM.
        OMNamespace ns2 = doomf.createOMNamespace("http://nsurl", "prefix");
        OMAttribute attr2 = doomf.createOMAttribute("attr2", ns2, "attr2value");

        OMElement ome2 = omf.createOMElement("element", ns2.getNamespaceURI(), ns2.getPrefix());
        AttributeHelper.importOMAttribute(attr2, ome2);
        assertNotSame(attr2, ome2.getAttribute(attr2.getQName()));
View Full Code Here

Examples of org.apache.axiom.om.OMFactory.createOMNamespace()

        OMElement ome3 = omf.createOMElement("element", ns3.getNamespaceURI(), ns3.getPrefix());
        AttributeHelper.importOMAttribute(attr3, ome3);
        assertSame(attr3, ome3.getAttribute(attr3.getQName()));

        //DOOM only.
        OMNamespace ns4 = doomf.createOMNamespace("http://nsurl", "prefix");
        OMAttribute attr4 = doomf.createOMAttribute("attr4", ns4, "attr4value");

        OMElement ome4 = doomf.createOMElement("element", ns4.getNamespaceURI(), ns4.getPrefix());
        AttributeHelper.importOMAttribute(attr4, ome4);
        assertSame(attr4, ome4.getAttribute(attr4.getQName()));
View Full Code Here

Examples of org.apache.axiom.om.OMFactory.createOMNamespace()

        super.setUp();
        DataHandler dataHandler;

        OMFactory fac = OMAbstractFactory.getOMFactory();

        OMNamespace soap = fac.createOMNamespace(
                "http://schemas.xmlsoap.org/soap/envelope/", "soap");
        envelope = fac.createOMElement("Envelope", soap);
        OMElement body = fac.createOMElement("Body", soap);

        OMNamespace dataName = fac.createOMNamespace(
View Full Code Here

Examples of org.apache.axiom.om.OMFactory.createOMNamespace()

        OMNamespace soap = fac.createOMNamespace(
                "http://schemas.xmlsoap.org/soap/envelope/", "soap");
        envelope = fac.createOMElement("Envelope", soap);
        OMElement body = fac.createOMElement("Body", soap);

        OMNamespace dataName = fac.createOMNamespace(
                "http://www.example.org/stuff", "m");
        OMElement data = fac.createOMElement("data", dataName);

        OMNamespace mime = fac.createOMNamespace(
                "http://www.w3.org/2003/06/xmlmime", "mime");
View Full Code Here

Examples of org.apache.axiom.om.OMFactory.createOMNamespace()

        OMNamespace dataName = fac.createOMNamespace(
                "http://www.example.org/stuff", "m");
        OMElement data = fac.createOMElement("data", dataName);

        OMNamespace mime = fac.createOMNamespace(
                "http://www.w3.org/2003/06/xmlmime", "mime");

        OMElement text = fac.createOMElement("name", dataName);
        OMAttribute cType1 = fac.createOMAttribute("contentType", mime,
                                                 "text/plain");
View Full Code Here

Examples of org.apache.axiom.om.OMFactory.createOMNamespace()

    }

    protected void runTest() throws Throwable {
        OMFactory factory = metaFactory.getOMFactory();
        // Use "new String" to create String objects that are not interned
        OMNamespace ns1 = factory.createOMNamespace(new String("urn:ns1"), "p");
        OMNamespace ns2 = factory.createOMNamespace(new String("urn:ns2"), "q");
        OMElement root = factory.createOMElement("root", ns1);
        root.addAttribute("attr", "value", ns2);
        factory.createOMElement("child", ns2, root);
       
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.