Package net.sf.saxon.xpath

Examples of net.sf.saxon.xpath.XPathFactoryImpl


        }

        out.xpath = xpathStr;
        try {
            __log.debug("Compiling expression " + xpathStr);
            XPathFactoryImpl xpf = new net.sf.saxon.xpath.XPathFactoryImpl();
            JaxpFunctionResolver funcResolver = new JaxpFunctionResolver(
                    _compilerContext, out, source.getNamespaceContext(), _bpelNS);
            xpf.setXPathFunctionResolver(funcResolver);
            JaxpVariableResolver varResolver = new JaxpVariableResolver(_compilerContext, out);
            xpf.setXPathVariableResolver(varResolver);

            XPathEvaluator xpe = (XPathEvaluator) xpf.newXPath();
            xpe.setStaticContext(new SaxonContext(xpf.getConfiguration(), varResolver, funcResolver));
            xpe.setXPathFunctionResolver(funcResolver);
            xpe.setNamespaceContext(source.getNamespaceContext());
            xpe.compile(xpathStr);
        } catch (XPathExpressionException e) {
            __log.debug(e);
View Full Code Here


        }

        out.xpath = xpathStr;
        try {
            __log.debug("Compiling expression " + xpathStr);
            XPathFactory xpf = new XPathFactoryImpl();
            JaxpFunctionResolver funcResolver = new JaxpFunctionResolver(
                    _compilerContext, out, source.getNamespaceContext(), _bpelNS);
            JaxpVariableResolver varResolver = new JaxpVariableResolver(_compilerContext, out);
            XPath xpe = xpf.newXPath();
            xpe.setXPathFunctionResolver(funcResolver);
            xpe.setXPathVariableResolver(varResolver);
            xpe.setNamespaceContext(source.getNamespaceContext());
            XPathExpression expr = xpe.compile(xpathStr);
            // evaluate the expression so as to initialize the variables
View Full Code Here

*/
public class XPathTest extends CamelTestSupport {

    @Test
    public void testXPathUsingSaxon() throws Exception {
        XPathFactory fac = new XPathFactoryImpl();
        XPathBuilder builder = XPathBuilder.xpath("foo/bar").factory(fac);

        // will evaluate as XPathConstants.NODESET and have Camel convert that to String
        // this should return the String incl. xml tags
        String name = builder.evaluate(context, "<foo><bar id=\"1\">cheese</bar></foo>", String.class);
View Full Code Here

    @Test
    public void testXPathFunctionSubstringUsingSaxon() throws Exception {
        String xml = "<foo><bar>Hello World</bar></foo>";

        XPathFactory fac = new XPathFactoryImpl();
        XPathBuilder builder = XPathBuilder.xpath("substring(/foo/bar, 7)").factory(fac);

        String result = builder.resultType(String.class).evaluate(context, xml, String.class);
        assertEquals("World", result);
View Full Code Here

*/
public class XPathTest extends CamelTestSupport {

    @Test
    public void testXPathUsingSaxon() throws Exception {
        XPathFactory fac = new XPathFactoryImpl();
        XPathBuilder builder = XPathBuilder.xpath("foo/bar").factory(fac);

        // will evaluate as XPathConstants.NODESET and have Camel convert that to String
        // this should return the String incl. xml tags
        String name = builder.evaluate(context, "<foo><bar id=\"1\">cheese</bar></foo>", String.class);
View Full Code Here

    @Test
    public void testXPathFunctionSubstringUsingSaxon() throws Exception {
        String xml = "<foo><bar>Hello World</bar></foo>";

        XPathFactory fac = new XPathFactoryImpl();
        XPathBuilder builder = XPathBuilder.xpath("substring(/foo/bar, 7)").factory(fac);

        String result = builder.resultType(String.class).evaluate(context, xml, String.class);
        assertEquals("World", result);
View Full Code Here

     * Returns instances of {@link XPathFactoryImpl}
     */
    @Override
    protected XPathFactory createXPathFactory()
    {
        return new XPathFactoryImpl();
    }
View Full Code Here

public class XsdTypesTest extends TestCase {
    private static Log __log = LogFactory.getLog(XsdTypesTest.class);

    public void testDateTime() throws Exception {
        XPathFactoryImpl xpf = new XPathFactoryImpl();
        JaxpVariableResolver jvr = new JaxpVariableResolver(null, null, xpf.getConfiguration());
        Object o = jvr.getSimpleContent(DOMUtils.stringToDOM("<temporary-simple-type-wrapper>2010-01-25T15:38:54.82Z</temporary-simple-type-wrapper>"), QName.valueOf("{http://www.w3.org/2001/XMLSchema}dateTime"));
        __log.debug(o);
        assertTrue(o.toString().contains("2010-01-25T15:38:54.82Z"));
    }
View Full Code Here

        __log.debug(o);
        assertTrue(o.toString().contains("2010-01-25T15:38:54.82Z"));
    }

    public void testEmptyDateTime() throws Exception {
        XPathFactoryImpl xpf = new XPathFactoryImpl();
        JaxpVariableResolver jvr = new JaxpVariableResolver(null, null, xpf.getConfiguration());
        Object o = jvr.getSimpleContent(DOMUtils.stringToDOM("<temporary-simple-type-wrapper></temporary-simple-type-wrapper>"), QName.valueOf("{http://www.w3.org/2001/XMLSchema}dateTime"));
        __log.debug(o);
        assertTrue(o.toString().equals(""));
    }
View Full Code Here

        }

        out.xpath = xpathStr;
        try {
            __log.debug("Compiling expression " + xpathStr);
            XPathFactory xpf = new XPathFactoryImpl();
            JaxpFunctionResolver funcResolver = new JaxpFunctionResolver(
                    _compilerContext, out, source.getNamespaceContext(),
                    _bpelNS);
            JaxpVariableResolver varResolver = new JaxpVariableResolver(
                    _compilerContext, out);
            XPath xpe = xpf.newXPath();
            xpe.setXPathFunctionResolver(funcResolver);
            xpe.setXPathVariableResolver(varResolver);
            xpe.setNamespaceContext(source.getNamespaceContext());
            XPathExpression expr = xpe.compile(xpathStr);
            // evaluate the expression so as to initialize the variables
View Full Code Here

TOP

Related Classes of net.sf.saxon.xpath.XPathFactoryImpl

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.