Package org.apache.axiom.om

Examples of org.apache.axiom.om.OMNamespace


    public LiveNamespaceContext(OMElement element) {
        this.element = element;
    }

    protected String doGetNamespaceURI(String prefix) {
        OMNamespace ns = element.findNamespaceURI(prefix);
        return ns == null ? XMLConstants.NULL_NS_URI : ns.getNamespaceURI();
    }
View Full Code Here


        OMNamespace ns = element.findNamespaceURI(prefix);
        return ns == null ? XMLConstants.NULL_NS_URI : ns.getNamespaceURI();
    }

    protected String doGetPrefix(String namespaceURI) {
        OMNamespace ns = element.findNamespace(namespaceURI, null);
        return ns == null ? null : ns.getPrefix();
    }
View Full Code Here

    }

    protected Iterator doGetPrefixes(String namespaceURI) {
        List prefixes = new ArrayList();
        for (Iterator it = element.getNamespacesInScope(); it.hasNext(); ) {
            OMNamespace ns = (OMNamespace)it.next();
            if (ns.getNamespaceURI().equals(namespaceURI)) {
                prefixes.add(ns.getPrefix());
            }
        }
        return prefixes.iterator();
    }
View Full Code Here

    protected void runTest() throws Throwable {
        SOAPEnvelope envelope = soapFactory.createSOAPEnvelope();
        SOAPBody body = soapFactory.createSOAPBody();
        envelope.addChild(body);
        OMNamespace ns = soapFactory.createOMNamespace("http://ns1", "d");
        OMElement payload = soapFactory.createOMElement(new DummySource(), "dummy", ns);
        payload.setNamespace(ns); // This line will cause NoSuchElementException
        body.addChild(payload);
        payload.getBuilder().setCache(false); // Or This line will cause NoSuchElementException
        StringWriter writer = new StringWriter();
View Full Code Here

                                                 OMXMLParserWrapper builder) {
        return new SOAP11FaultDetailImpl(parent, builder, this);
    }

    public SOAPEnvelope getDefaultEnvelope() throws SOAPProcessingException {
        OMNamespace ns =
                new OMNamespaceImpl(
                        SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI,
                        SOAP11Constants.SOAP_DEFAULT_NAMESPACE_PREFIX);
        SOAPEnvelopeImpl env = new SOAPEnvelopeImpl(ns, this);
        createSOAPHeader(env);
View Full Code Here

       
        // Create a payload
        String text = "<tns:payload xmlns:tns=\"urn://test\">Hello World</tns:payload>";
        String encoding = "UTF-8";
        ByteArrayDataSource bads = new ByteArrayDataSource(text.getBytes(encoding), encoding);
        OMNamespace ns = body.getOMFactory().createOMNamespace("urn://test", "tns");
        OMSourcedElement omse =body.getOMFactory().createOMElement(bads, "payload", ns);
        body.addChild(omse);
        copyAndCheck(sourceEnv);
    }
View Full Code Here

    protected void runTest() throws Throwable {
        SOAPEnvelope envelope = soapFactory.getDefaultEnvelope();
        OMElement bodyElement = soapFactory.createOMElement(qname.getLocalPart(), qname.getNamespaceURI(), qname.getPrefix());
        envelope.getBody().addChild(bodyElement);
        assertEquals(qname.getLocalPart(), envelope.getSOAPBodyFirstElementLocalName());
        OMNamespace ns = envelope.getSOAPBodyFirstElementNS();
        if (qname.getNamespaceURI().length() == 0) {
            assertNull(ns);
        } else {
            assertEquals(qname.getNamespaceURI(), ns.getNamespaceURI());
            assertEquals(qname.getPrefix(), ns.getPrefix());
        }
    }
View Full Code Here

    }

    public boolean equals(Object obj) {
        if (!(obj instanceof OMNamespace)) return false;
        OMNamespace other = (OMNamespace)obj;
        String otherPrefix = other.getPrefix();
        return (uri.equals(other.getNamespaceURI()) &&
                (prefix == null ? otherPrefix == null :
                        prefix.equals(otherPrefix)));
    }
View Full Code Here

        mtomOutputFormat.setDoOptimize(true);
        OMOutputFormat baseOutputFormat = new OMOutputFormat();
        baseOutputFormat.setDoOptimize(false);

        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace soap = fac.createOMNamespace(
                "http://schemas.xmlsoap.org/soap/envelope/", "soap");
        OMElement 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);

        DataSource dataSource = getTestResourceDataSource(imageInFileName);
        expectedDH = new DataHandler(dataSource);
View Full Code Here

    }

    protected void runTest() throws Throwable {
        OMFactory factory = metaFactory.getOMFactory();
        OMElement parent = factory.createOMElement("parent", "urn:test", "");
        OMNamespace ns = useNull ? null : factory.createOMNamespace("", "");
        OMElement child = factory.createOMElement("child", ns);
        parent.addChild(child);
        assertNull(child.getNamespace());
    }
View Full Code Here

TOP

Related Classes of org.apache.axiom.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.