Package org.apache.axiom.om.xpath

Examples of org.apache.axiom.om.xpath.AXIOMXPath.addNamespaces()


            AXIOMXPath xpath = new AXIOMXPath(xpathString);
            // here if user has given prefix namespace mappings
            // we use it. otherwise get from the om element existing
            // mappings
            if ((namespacePrefixes == null) || namespacePrefixes.isEmpty()) {
                xpath.addNamespaces(eventOMElement);
            } else {
                for(XpathDefinition xpathDefinition : namespacePrefixes){
                    xpath.addNamespace(xpathDefinition.getPrefix(),xpathDefinition.getNamespace());
                }
               /* for (String prefix : namespacePrefixes.keySet()) {
View Full Code Here


     */
    private AXIOMXPath createAxiomXPath(OMElement source, String xpath) {
        try {

            AXIOMXPath axiomxPath = new AXIOMXPath(xpath);
            axiomxPath.addNamespaces(source);
            return axiomxPath;
        } catch (JaxenException e) {
            throw new LoggedRuntimeException("Error creating XPath " + xpath, log);
        }
    }
View Full Code Here

            return null;
        }
        try {
            AXIOMXPath axiomxPath = new AXIOMXPath(xpath);
            OMElement xml = (OMElement) messageInterceptor.extractEnvelope(message).getValue();
            axiomxPath.addNamespaces(xml);
            return XPathHelper.evaluate(xml, axiomxPath);
        } catch (JaxenException e) {
            throw new LoggedRuntimeException("Error creating XPath " + xpath, log);
        }
    }
View Full Code Here

        OMElement root1 = AXIOMUtil.stringToOM(
                "<ns1:root xmlns:ns1='urn:ns1'><ns1:child xmlns:ns2='urn:ns2'/></root>");
        OMElement root2 = AXIOMUtil.stringToOM(
                "<root xmlns='urn:ns1'><child xmlns='urn:ns2'>text</child></root>");
        AXIOMXPath xpath = new AXIOMXPath("/ns1:root/ns2:child");
        xpath.addNamespaces(root1.getFirstElement());
        assertEquals("text", xpath.stringValueOf(root2.getParent()));
    }

    public void testAddNamespaces2() throws Exception {
        OMElement root1 = AXIOMUtil.stringToOM(
View Full Code Here

        OMElement root1 = AXIOMUtil.stringToOM(
                "<ns:root xmlns:ns='urn:ns1'><ns:child xmlns:ns='urn:ns2'/></root>");
        OMElement root2 = AXIOMUtil.stringToOM(
                "<root xmlns='urn:ns1'><child xmlns='urn:ns2'>text</child></root>");
        AXIOMXPath xpath = new AXIOMXPath("//ns:child");
        xpath.addNamespaces(root1.getFirstElement());
        assertEquals("text", xpath.stringValueOf(root2.getParent()));
    }
}
View Full Code Here

        OMElement root1 = AXIOMUtil.stringToOM(factory,
                "<ns1:root xmlns:ns1='urn:ns1'><ns1:child xmlns:ns2='urn:ns2'/></root>");
        OMElement root2 = AXIOMUtil.stringToOM(factory,
                "<root xmlns='urn:ns1'><child xmlns='urn:ns2'>text</child></root>");
        AXIOMXPath xpath = new AXIOMXPath("/ns1:root/ns2:child");
        xpath.addNamespaces(root1.getFirstElement());
        assertEquals("text", xpath.stringValueOf(root2.getParent()));
    }
}
View Full Code Here

        OMElement root1 = AXIOMUtil.stringToOM(factory,
                "<ns:root xmlns:ns='urn:ns1'><ns:child xmlns:ns='urn:ns2'/></root>");
        OMElement root2 = AXIOMUtil.stringToOM(factory,
                "<root xmlns='urn:ns1'><child xmlns='urn:ns2'>text</child></root>");
        AXIOMXPath xpath = new AXIOMXPath("//ns:child");
        xpath.addNamespaces(root1.getFirstElement());
        assertEquals("text", xpath.stringValueOf(root2.getParent()));
    }
}
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.