Package org.apache.axiom.om

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


                        "xmlns:myAttr1NS=\"http://test-attributes-1.org\" myAttr2NS:attrNumber=\"2\" myAttr1NS:attrNumber=\"1\" />";
   
        OMFactory omFactory = metaFactory.getOMFactory();
   
        OMNamespace attrNS1 =
                omFactory.createOMNamespace("http://test-attributes-1.org", "myAttr1NS");
        OMNamespace attrNS2 =
                omFactory.createOMNamespace("http://test-attributes-2.org", "myAttr2NS");
        OMElement omElement = omFactory.createOMElement("AttributeTester", null);
        omElement.addAttribute(omFactory.createOMAttribute("attrNumber", attrNS1, "1"));
        omElement.addAttribute(omFactory.createOMAttribute("attrNumber", attrNS2, "2"));
View Full Code Here


        OMFactory omFactory = metaFactory.getOMFactory();
   
        OMNamespace attrNS1 =
                omFactory.createOMNamespace("http://test-attributes-1.org", "myAttr1NS");
        OMNamespace attrNS2 =
                omFactory.createOMNamespace("http://test-attributes-2.org", "myAttr2NS");
        OMElement omElement = omFactory.createOMElement("AttributeTester", null);
        omElement.addAttribute(omFactory.createOMAttribute("attrNumber", attrNS1, "1"));
        omElement.addAttribute(omFactory.createOMAttribute("attrNumber", attrNS2, "2"));
   
        int nsCount = 0;
View Full Code Here

        OMFactory factory = metaFactory.getOMFactory();
       
        String localName = "myPayload";
        String encoding = "utf-8";
        String payload1 = "<tns:myPayload xmlns:tns=\"urn://test\">Payload One</tns:myPayload>";
        OMNamespace ns = factory.createOMNamespace("urn://test", "tns");
        ByteArrayInputStream bais1 = new ByteArrayInputStream(payload1.getBytes(encoding));
        InputStreamDataSource isds1 = new InputStreamDataSource(bais1, encoding);
       
        OMElement parent = factory.createOMElement("root", null);
        OMSourcedElement omse = factory.createOMElement(isds1, localName, ns);
View Full Code Here

        super(metaFactory);
    }

    protected void runTest() throws Throwable {
        OMFactory factory = metaFactory.getOMFactory();
        OMNamespace testNamespace = factory.createOMNamespace("http://test.ws.org", "test");
        OMElement documentElement = factory.createOMElement("Employees", testNamespace);
        documentElement.declareNamespace(testNamespace);
        OMText txt = factory.createOMText(documentElement, " ");
        OMElement e = factory.createOMElement("Employee", testNamespace, documentElement);
        e.setText("Apache Developer");
View Full Code Here

        super(metaFactory);
    }

    protected void setUp() throws Exception {
        OMFactory f = metaFactory.getOMFactory();
        OMNamespace ns = f.createOMNamespace("http://www.sosnoski.com/uwjws/library", "");
        OMNamespace rootNS = f.createOMNamespace("http://sampleroot", "rootPrefix");
        element = f.createOMElement(new TestDataSource(testDocument), "library", ns);
        root = f.createOMElement("root", rootNS);
        root.addChild(element);
    }
View Full Code Here

    }

    protected void setUp() throws Exception {
        OMFactory f = metaFactory.getOMFactory();
        OMNamespace ns = f.createOMNamespace("http://www.sosnoski.com/uwjws/library", "");
        OMNamespace rootNS = f.createOMNamespace("http://sampleroot", "rootPrefix");
        element = f.createOMElement(new TestDataSource(testDocument), "library", ns);
        root = f.createOMElement("root", rootNS);
        root.addChild(element);
    }
}
View Full Code Here

        OMCloneOptions options = new OMCloneOptions();
        options.setCopyOMDataSources(true);
        OMElement clone = (OMElement)element.clone(options);
        assertTrue(clone instanceof OMSourcedElement);
        assertFalse(element.isExpanded());
        OMNamespace expectedNS = factory.createOMNamespace("urn:ns", "p");
        assertEquals("element", element.getLocalName());
        assertEquals("element", clone.getLocalName());
        assertEquals(expectedNS, element.getNamespace());
        assertEquals(expectedNS, clone.getNamespace());
    }
View Full Code Here

        OMFactory factory = metaFactory.getOMFactory();
       
        String localName = "myPayload";
        String encoding = "utf-8";
        String payload1 = "<tns:myPayload xmlns:tns=\"urn://test\">Payload One</tns:myPayload>";
        OMNamespace ns = factory.createOMNamespace("urn://test", "tns");
        CharArrayDataSource cads = new CharArrayDataSource(payload1.toCharArray());

        OMElement parent = factory.createOMElement("root", null);
        OMSourcedElement omse = factory.createOMElement(cads, localName, ns);
        parent.addChild(omse);
View Full Code Here

    }

    protected void runTest() throws Throwable {
        OMFactory factory = metaFactory.getOMFactory();
        // Use same namespace URI but different prefixes
        OMNamespace ns1 = factory.createOMNamespace("urn:ns", "p1");
        OMNamespace ns2 = factory.createOMNamespace("urn:ns", "p2");
        OMElement element = factory.createOMElement(new QName("test"));
        OMAttribute att1 = element.addAttribute("test", "value1", ns1);
        OMAttribute att2 = element.addAttribute("test", "value2", ns2);
        Iterator it = element.getAllAttributes();
View Full Code Here

    protected void runTest() throws Throwable {
        OMFactory factory = metaFactory.getOMFactory();
        // Use same namespace URI but different prefixes
        OMNamespace ns1 = factory.createOMNamespace("urn:ns", "p1");
        OMNamespace ns2 = factory.createOMNamespace("urn:ns", "p2");
        OMElement element = factory.createOMElement(new QName("test"));
        OMAttribute att1 = element.addAttribute("test", "value1", ns1);
        OMAttribute att2 = element.addAttribute("test", "value2", ns2);
        Iterator it = element.getAllAttributes();
        assertTrue(it.hasNext());
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.