Package org.apache.axis2.om

Examples of org.apache.axis2.om.OMNamespace


    }

    public void testChildrenRetrievalWithNoDetaching() {

        OMFactory factory = OMAbstractFactory.getOMFactory();
        OMNamespace testNamespace = factory.createOMNamespace("http://test.axis2.org", "test");
        OMElement documentElement = getSampleDocumentElement(testNamespace);

        Iterator childrenIter = new OMChildrenWithSpecificAttributeIterator(
                documentElement.getFirstOMChild(), new QName(testNamespace.getName(), "myAttr",
                testNamespace.getPrefix()), "Axis2", false);

        int childCount = getChidrenCount(childrenIter);
        assertEquals("Iterator must return 5 children with the given attribute", childCount, 5);

        Iterator children = documentElement.getChildren();
View Full Code Here


    /*
     * @see TestCase#setUp()
     */
    protected void setUp() throws Exception {
       OMNamespace testingNamespace = factory.createOMNamespace(
                        "http://testing.axis2.org", "axis2");
        firstElement = factory.createOMElement("FirstElement", testingNamespace);
        secondElement = factory.createOMElement("SecondElement", factory.createOMNamespace(
                                "http://moretesting.axis2.org", "axis2"), firstElement);
    }
View Full Code Here

        assertTrue("Namespace having same information, declared in the same context, should share" +
                " the same namespace object",firstElement.getNamespace() != secondElement.getNamespace());
        assertEquals("OMElement children addition has not worked properly", secondElement, firstElement.getFirstElement());

        OMNamespace testNamespace2 = factory.createOMNamespace("ftp://anotherTest.axis2.org", "axis2");
        firstElement.declareNamespace(testNamespace2);

        OMNamespace inheritedSecondNamespace = secondElement.findNamespace(testNamespace2.getName(),
                testNamespace2.getPrefix());
        assertNotNull("Children should inherit namespaces declared in parent", inheritedSecondNamespace);
        assertEquals("inherited namespace uri should be equal", inheritedSecondNamespace.getName(), testNamespace2.getName());
        assertEquals("inherited namespace prefix should be equal", inheritedSecondNamespace.getPrefix(), testNamespace2.getPrefix());


    }
View Full Code Here


    }

    public void testChildDetachment() {
        OMNamespace testNamespace2 = factory.createOMNamespace("ftp://anotherTest.axis2.org", "axis2");
       
        secondElement.detach();
        assertTrue("OMElement children detachment has not worked properly", !secondElement.equals(firstElement.getFirstElement()));
        assertNull("First Element should not contain elements after detaching. ", firstElement.getFirstElement());
        assertNull("First Element should not contain elements after detaching. ", firstElement.getFirstOMChild());
        assertNull(secondElement.findNamespace(testNamespace2.getName(), testNamespace2.getPrefix()));

        firstElement.addChild(secondElement);
        firstElement.setText("Some Sample Text");

        assertTrue("First added child must be the first child", secondElement.equals(firstElement.getFirstOMChild()));
View Full Code Here

     * @param prefix
     * @return Returns OMNamespace.
     */
    public OMNamespace createOMNamespace(String uri, String prefix) {
        String key = uri + uriAndPrefixSeparator + prefix;
        OMNamespace existingNamespaceObject = (OMNamespace) namespaceTable.get(key);
        if (existingNamespaceObject == null) {
            existingNamespaceObject = new OMNamespaceImpl(uri, prefix);
            namespaceTable.put(key, existingNamespaceObject);
        }
        return existingNamespaceObject;
View Full Code Here

        }
    }

    String buildBlankOMElem() throws XMLStreamException {
        OMFactory factory = OMAbstractFactory.getOMFactory();
        OMNamespace namespace1 = factory.createOMNamespace("", "");
        OMElement elem1 = factory.createOMElement("", namespace1);

        StringWriter writer = new StringWriter();
        elem1.build();
        elem1.serialize(writer);
View Full Code Here

        }
    }

    String buildWithWhiteSpaceOMElem() throws XMLStreamException {
        OMFactory factory = OMAbstractFactory.getOMFactory();
        OMNamespace namespace1 = factory.createOMNamespace("  ", "");
        OMElement elem1 = factory.createOMElement("  ", namespace1);

        StringWriter writer = new StringWriter();
        elem1.build();
        elem1.serialize(writer);
View Full Code Here

                property = (Boolean) msgContext.getProperty(Constants.Configuration.DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
        if (property != null && property.booleanValue()) {
            log.info("Addressing is disbaled .....");
            return;
        }
        OMNamespace addressingNamespaceObject;
        String addressingNamespace = null;

        Object addressingVersionFromCurrentMsgCtxt = msgContext.getProperty(WS_ADDRESSING_VERSION);
        if (addressingVersionFromCurrentMsgCtxt != null) {
            // since we support only two addressing versions I can avoid multiple  ifs here.
View Full Code Here

                "attrNS:Attr3=\"Value 3\" attrNS:Attr1=\"Value 1\"\n" +
                "              attrNS:Attr5=\"Value 5\" attrNS:Attr4=\"Value 4\"></emp:Employee>";

        OMFactory factory = OMAbstractFactory.getOMFactory();
        QName elementQName = new QName("http://ec.org/software", "Employee", "emp");
        OMNamespace attrNS = factory.createOMNamespace("mailto:whoever@whatever.com", "attrNS");

        // add some attributes with namespaces
        OMAttribute[] attribute = new OMAttribute[5];
        for (int i = 0; i < 5; i++) {
            attribute[i] = factory.createOMAttribute("Attr" + (i + 1), attrNS, "Value " + (i + 1));
View Full Code Here

                "<Dependent><Name>FooTwo</Name><Age>25</Age><Sex>Male</Sex></Dependent>" +
                "<axis2:SecondOMElement xmlns:axis2=\"http://ws.apache.org/namespaces/axis2\">" +
                "</axis2:SecondOMElement></OMElementTest>";

        OMFactory factory = OMAbstractFactory.getOMFactory();
        OMNamespace axis2Namespace = factory.createOMNamespace(Constants.AXIS2_NAMESPACE_URI, Constants.AXIS2_NAMESPACE_PREFIX);
        OMElement firstElement = factory.createOMElement("FirstOMElement", axis2Namespace);
        OMElement secondElement = factory.createOMElement("SecondOMElement", axis2Namespace, firstElement);

        ArrayList propertyList = new ArrayList();
View Full Code Here

TOP

Related Classes of org.apache.axis2.om.OMNamespace

Copyright © 2018 www.massapicom. 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.