Examples of declareDefaultNamespace()


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

        OMElement documentElement = omFac.createOMElement("RootElement", null);
        OMNamespace ns1 = documentElement.declareNamespace("http://one.org", "ns1");
        OMNamespace ns2 = documentElement.declareNamespace("http://one.org", "ns2");

        OMElement childOne = omFac.createOMElement("ChildElementOne", ns2, documentElement);
        childOne.declareDefaultNamespace("http://one.org");

        OMElement childTwo = omFac.createOMElement("ChildElementTwo", ns1, childOne);

        assertEquals(1, getNumberOfOccurrences(documentElement.toStringWithConsume(),
                "xmlns:ns2=\"http://one.org\""));
View Full Code Here

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

    protected void runTest() throws Throwable {
        OMFactory factory = metaFactory.getOMFactory();
        OMElement element = factory.createOMElement("test", null);
        try {
            element.declareDefaultNamespace("urn:test");
            fail("Expected OMException");
        } catch (OMException ex) {
            // Expected
        }
    }
View Full Code Here

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

    for (Map.Entry<String, String> entry : namespaceMappings.entrySet()) {
      String prefix = entry.getKey();
      String namespaceUri = entry.getValue();

      if (XMLConstants.DEFAULT_NS_PREFIX.equals(prefix)) {
        element.declareDefaultNamespace(namespaceUri);
      } else {
        element.declareNamespace(namespaceUri, prefix);
      }
    }
    // declare attributes
View Full Code Here

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

        OMElement documentElement = omFac.createOMElement("RootElement",
                omFac.createOMNamespace("http://one.org", ""));

        OMNamespace ns = omFac.createOMNamespace("http://ws.apache.org/axis2", "ns2");
        OMElement childOne = omFac.createOMElement("ChildElementOne", ns, documentElement);
        childOne.declareDefaultNamespace("http://two.org");

        OMElement childTwo = omFac.createOMElement("ChildElementTwo",
                omFac.createOMNamespace("http://one.org", ""), childOne);

        assertEquals(2, getNumberOfOccurrences(documentElement.toStringWithConsume(),
View Full Code Here

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

                omFactory.createOMNamespace("http://defaultNS1.org", ""));
        OMElement omElementOneChild = omFactory.createOMElement("ChildOne", null, omElementOne);


        OMElement omElementTwo = omFactory.createOMElement("Foo", defaultNS2, omElementOne);
        omElementTwo.declareDefaultNamespace("http://defaultNS2.org");
        OMElement omElementTwoChild = omFactory.createOMElement("ChildOne", null, omElementTwo);

        OMElement omElementThree = omFactory.createOMElement("Bar", defaultNS1, omElementTwo);
        omElementThree.declareDefaultNamespace("http://defaultNS1.org");
View Full Code Here

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

        OMElement omElementTwo = omFactory.createOMElement("Foo", defaultNS2, omElementOne);
        omElementTwo.declareDefaultNamespace("http://defaultNS2.org");
        OMElement omElementTwoChild = omFactory.createOMElement("ChildOne", null, omElementTwo);

        OMElement omElementThree = omFactory.createOMElement("Bar", defaultNS1, omElementTwo);
        omElementThree.declareDefaultNamespace("http://defaultNS1.org");

        OMNamespace omElementOneChildNS = omElementOneChild.getNamespace();
        OMNamespace omElementTwoChildNS = omElementTwoChild.getNamespace();
        // TODO: LLOM's and DOOM's behaviors are slightly different here; need to check if both are allowed
        assertTrue(omElementOneChildNS == null || "".equals(omElementOneChildNS.getNamespaceURI()));
View Full Code Here

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

    protected void runTest() throws Throwable {
        OMFactory factory = metaFactory.getOMFactory();
        OMNamespace ns = factory.createOMNamespace("urn:ns1", "");
        OMElement element = factory.createOMElement("test", ns);
        try {
            element.declareDefaultNamespace("urn:ns2");
            fail("Expected OMException");
        } catch (OMException ex) {
            // Expected
        }
    }
View Full Code Here

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

                                      "samlp");

        OMElement artifactResponse =
            factory.createOMElement("ArtifactResponse", samlp, soapBody);
        OMNamespace saml =
            artifactResponse.declareDefaultNamespace("urn:oasis:names:tc:SAML:2.0:assertion");
        artifactResponse.addAttribute("ID", "foo1", null);
        artifactResponse.addAttribute("Version", "2.0", null);
        artifactResponse.addAttribute("InResponseTo", "Unspecified", null);
        artifactResponse.addAttribute("IssueInstant",
                                      artifactRequest.getIssueInstant(), null);
View Full Code Here

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

        OMElement omElement = parent == null ? omf.createOMElement(src.getLocalName(), null) :
                omf.createOMElement(src.getLocalName(), null, parent);
        if (src.getNamespaceURI() != null) {
            if (src.getPrefix() != null)
                omElement.setNamespace(omf.createOMNamespace(src.getNamespaceURI(), src.getPrefix()));
            else omElement.declareDefaultNamespace(src.getNamespaceURI());
        }
       
        if (parent == null) {
            NSContext nscontext = DOMUtils.getMyNSContext(src);
            injectNamespaces(omElement,nscontext.toMap());
View Full Code Here

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

        OMElement omElement = parent == null ? omf.createOMElement(src.getLocalName(), null) :
                omf.createOMElement(src.getLocalName(), null, parent);
        if (src.getNamespaceURI() != null) {
            if (src.getPrefix() != null)
                omElement.setNamespace(omf.createOMNamespace(src.getNamespaceURI(), src.getPrefix()));
            else omElement.declareDefaultNamespace(src.getNamespaceURI());
        }

        if (parent == null) {
            NSContext nscontext = DOMUtils.getMyNSContext(src);
            injectNamespaces(omElement,nscontext.toMap());
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.