Package net.sf.saxon.sxpath

Examples of net.sf.saxon.sxpath.XPathEvaluator.createExpression()


                    NodeInfo moduleAtt = (NodeInfo)exp.evaluateSingle((NodeInfo)root);
                    String module = (moduleAtt == null ? null : moduleAtt.getStringValue());
                    exp = xpath.createExpression("/error/@line");
                    NodeInfo lineAtt = (NodeInfo)exp.evaluateSingle((NodeInfo)root);
                    int line = (lineAtt == null ? -1 : Integer.parseInt(lineAtt.getStringValue()));
                    exp = xpath.createExpression("/error/@column");
                    NodeInfo columnAtt = (NodeInfo)exp.evaluateSingle((NodeInfo)root);
                    int column = (columnAtt == null ? -1 : Integer.parseInt(columnAtt.getStringValue()));
                    ExpressionLocation locator = new ExpressionLocation();
                    locator.setSystemId(module);
                    locator.setLineNumber(line);
View Full Code Here


                Object sources = Transform.loadDocuments(argvalue, useURLs, config, true);
                dynamicEnv.setParameter(argname.substring(1), sources);
            } else if (argname.startsWith("?")) {
                // parameters starting with "?" are taken as XPath expressions
                XPathEvaluator xpe = new XPathEvaluator(getConfiguration());
                XPathExpression expr = xpe.createExpression(argvalue);
                XPathDynamicContext context = expr.createDynamicContext(null);
                ValueRepresentation val = SequenceExtent.makeSequenceExtent(expr.iterate(context));
                dynamicEnv.setParameter(argname.substring(1), val);               
            } else {
                dynamicEnv.setParameter(argname, new UntypedAtomicValue(argvalue));
View Full Code Here

                Object sources = loadDocuments(argvalue, useURLs, config, true);
                controller.setParameter(argname.substring(1), sources);
            } else if (argname.startsWith("?")) {
                // parameters starting with "?" are taken as XPath expressions
                XPathEvaluator xpe = new XPathEvaluator(controller.getConfiguration());
                XPathExpression expr = xpe.createExpression(argvalue);
                XPathDynamicContext context = expr.createDynamicContext(null);
                ValueRepresentation val = SequenceExtent.makeSequenceExtent(expr.iterate(context));
                controller.setParameter(argname.substring(1), val);
            } else {
                controller.setParameter(argname, new UntypedAtomicValue(argvalue));
View Full Code Here

            }
        }
        try {
            XPathEvaluator eval = new XPathEvaluator(processor.getUnderlyingConfiguration());
            eval.setStaticContext(ic);
            XPathExpression cexp = eval.createExpression(source);
            return new XPathExecutable(cexp, processor, ic);
        } catch (XPathException e) {
            throw new SaxonApiException(e);
        }
    }
View Full Code Here

    public XPathExecutable compile(String source) throws SaxonApiException {
        try {
            XPathEvaluator eval = new XPathEvaluator(config);
            eval.setStaticContext(env);
            XPathExpression cexp = eval.createExpression(source);
            return new XPathExecutable(cexp, config, env, declaredVariables);
        } catch (XPathException e) {
            throw new SaxonApiException(e);
        }
    }
View Full Code Here

            xpe.setStaticContext(sc);

            Variable thisVar = sc.declareVariable(_contextVar);
            thisVar.setValue(needsDomSourceWrapping ? rootNode : node);

            XPathExpression exp = xpe.createExpression(_queryExpr);

            // After 8.3(?) Saxon nodes no longer implement Dom.
            // The client needs saxon8-dom.jar, and the code needs
            // this NodeOverNodeInfo Dom wrapper doohickey
            List saxonNodes = exp.evaluate(rootNode);
View Full Code Here

            Value errorObject = ((Value)SequenceExtent.makeSequenceExtent(argument[2].iterate(context))).reduce();
            if (errorObject instanceof SingletonNode) {
                NodeInfo root = ((SingletonNode)errorObject).getNode();
                if (root.getNodeKind() == Type.DOCUMENT) {
                    XPathEvaluator xpath = new XPathEvaluator();
                    XPathExpression exp = xpath.createExpression("/error/@module");
                    NodeInfo moduleAtt = (NodeInfo)exp.evaluateSingle(root);
                    String module = (moduleAtt == null ? null : moduleAtt.getStringValue());
                    exp = xpath.createExpression("/error/@line");
                    NodeInfo lineAtt = (NodeInfo)exp.evaluateSingle(root);
                    int line = (lineAtt == null ? -1 : Integer.parseInt(lineAtt.getStringValue()));
View Full Code Here

                if (root.getNodeKind() == Type.DOCUMENT) {
                    XPathEvaluator xpath = new XPathEvaluator();
                    XPathExpression exp = xpath.createExpression("/error/@module");
                    NodeInfo moduleAtt = (NodeInfo)exp.evaluateSingle(root);
                    String module = (moduleAtt == null ? null : moduleAtt.getStringValue());
                    exp = xpath.createExpression("/error/@line");
                    NodeInfo lineAtt = (NodeInfo)exp.evaluateSingle(root);
                    int line = (lineAtt == null ? -1 : Integer.parseInt(lineAtt.getStringValue()));
                    exp = xpath.createExpression("/error/@column");
                    NodeInfo columnAtt = (NodeInfo)exp.evaluateSingle(root);
                    int column = (columnAtt == null ? -1 : Integer.parseInt(columnAtt.getStringValue()));
View Full Code Here

                    NodeInfo moduleAtt = (NodeInfo)exp.evaluateSingle(root);
                    String module = (moduleAtt == null ? null : moduleAtt.getStringValue());
                    exp = xpath.createExpression("/error/@line");
                    NodeInfo lineAtt = (NodeInfo)exp.evaluateSingle(root);
                    int line = (lineAtt == null ? -1 : Integer.parseInt(lineAtt.getStringValue()));
                    exp = xpath.createExpression("/error/@column");
                    NodeInfo columnAtt = (NodeInfo)exp.evaluateSingle(root);
                    int column = (columnAtt == null ? -1 : Integer.parseInt(columnAtt.getStringValue()));
                    ExpressionLocation locator = new ExpressionLocation();
                    locator.setSystemId(module);
                    locator.setLineNumber(line);
View Full Code Here

    public static void main(String[] args) throws Exception {
        Configuration config = new Configuration();
        Expression exp;
        if (args[0].equals("xpath")) {
            XPathEvaluator xpath = new XPathEvaluator(config);
            XPathExpression xpexp = xpath.createExpression(args[1]);
            exp = xpexp.getInternalExpression();
        } else if (args[0].equals("xquery")) {
            StaticQueryContext sqc = new StaticQueryContext(config);
            sqc.setBaseURI(new File(args[1]).toURI().toString());
            XQueryExpression xqe = sqc.compileQuery(new FileReader(args[1]));
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.