Examples of declareNamespace()


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

       
        // Create a root element on which we declare the namespaces
        OMElement root = factory.createOMElement("root", null);
        OMNamespace ns1 = root.declareNamespace("urn:ns1", "ns1");
        OMNamespace ns2 = root.declareNamespace("urn:ns2", "ns2");
        root.declareNamespace("urn:ns3", "ns3");
       
        // Create a child that uses these namespaces (in the element name and in the name of an attribute)
        OMElement child = factory.createOMElement("child", ns1, root);
        child.addAttribute("attr", "value", ns2);
       
View Full Code Here

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

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

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

    }

    protected void runTest() throws Throwable {
        OMFactory factory = metaFactory.getOMFactory();
        OMElement element = factory.createOMElement("test", null);
        element.declareNamespace("urn:a", "a");
        element.declareNamespace("urn:b", "b");
        element.declareNamespace("urn:c", "c");
        for (Iterator it = element.getAllDeclaredNamespaces(); it.hasNext(); ) {
            OMNamespace ns = (OMNamespace)it.next();
            if (ns.getPrefix().equals("b")) {
View Full Code Here

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

    protected void runTest() throws Throwable {
        OMFactory factory = metaFactory.getOMFactory();
        OMElement element = factory.createOMElement("test", null);
        element.declareNamespace("urn:a", "a");
        element.declareNamespace("urn:b", "b");
        element.declareNamespace("urn:c", "c");
        for (Iterator it = element.getAllDeclaredNamespaces(); it.hasNext(); ) {
            OMNamespace ns = (OMNamespace)it.next();
            if (ns.getPrefix().equals("b")) {
                it.remove();
View Full Code Here

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

    protected void runTest() throws Throwable {
        OMFactory factory = metaFactory.getOMFactory();
        OMElement element = factory.createOMElement("test", null);
        element.declareNamespace("urn:a", "a");
        element.declareNamespace("urn:b", "b");
        element.declareNamespace("urn:c", "c");
        for (Iterator it = element.getAllDeclaredNamespaces(); it.hasNext(); ) {
            OMNamespace ns = (OMNamespace)it.next();
            if (ns.getPrefix().equals("b")) {
                it.remove();
                break;
View Full Code Here

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

    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");

        Iterator childrenIter = documentElement.getChildrenWithName(new QName("http://test.ws.org", "Employee", "test"));
View Full Code Here

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

      String namespaceUri = entry.getValue();

      if (XMLConstants.DEFAULT_NS_PREFIX.equals(prefix)) {
        element.declareDefaultNamespace(namespaceUri);
      } else {
        element.declareNamespace(namespaceUri, prefix);
      }
    }
    // declare attributes
    for (int i = 0; i < attributes.getLength(); i++) {
      QName attrName =
View Full Code Here

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

        try {
            SOAPHeaderBlock upgrade = getAxiomHeader().addHeaderBlock("Upgrade", getAxiomHeader().getNamespace());
            for (String supportedSoapUri : supportedSoapUris) {
                OMElement supportedEnvelope = getAxiomFactory()
                        .createOMElement("SupportedEnvelope", getAxiomHeader().getNamespace(), upgrade);
                OMNamespace namespace = supportedEnvelope.declareNamespace(supportedSoapUri, "");
                supportedEnvelope.addAttribute("qname", namespace.getPrefix() + ":Envelope", null);
            }
            return new AxiomSoapHeaderElement(upgrade, getAxiomFactory());
        }
        catch (OMException ex) {
View Full Code Here

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

        for (int i = 0; i < method.length; i++) {
            JMethod jmethod = method[i];
            OMElement operation = fac.createOMElement(OPERATION_LOCAL_NAME,
                    wsdl);
            binding.addChild(operation);
            operation.declareNamespace(URI_WSDL12_SOAP, SOAP12_PREFIX);

            addExtensionElement(fac, operation, soap12, OPERATION_LOCAL_NAME,
                    SOAP_ACTION, URN_PREFIX + COLON_SEPARATOR
                    + jmethod.getSimpleName(), STYLE, style);
            operation.addAttribute(ATTRIBUTE_NAME, jmethod.getSimpleName(),
View Full Code Here

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

    }

    protected void runTest() throws Throwable {
        OMFactory factory = metaFactory.getOMFactory();
        OMElement element = factory.createOMElement(new QName("test"));
        OMNamespace ns = element.declareNamespace("urn:ns", null);
        assertEquals("urn:ns", ns.getNamespaceURI());
        assertNotNull(ns.getPrefix());
        assertTrue(ns.getPrefix().length() > 0);
        Iterator it = element.getAllDeclaredNamespaces();
        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.