Examples of XPathVariable


Examples of net.sf.saxon.sxpath.XPathVariable

                Map.Entry entry = (Map.Entry) namespaceMap[i];
                sc.declareNamespace((String) entry.getKey(),
                        (String) entry.getValue());
            }
            xpe.setStaticContext(sc);
            XPathVariable thisVar = xpe.declareVariable("", contextVar);
            XPathExpression xpath = xpe.createExpression(path);
            NodeInfo contextItem =
                //config.buildDocument(new DOMSource(contextNode));
                config.unravel(new DOMSource(contextNode));
            XPathDynamicContext dc = xpath.createDynamicContext(null);
View Full Code Here

Examples of net.sf.saxon.sxpath.XPathVariable

        if (ic.isAllowUndeclaredVariables()) {
            // self-declaring variables modify the static context. The XPathCompiler must not change state
            // as the result of compiling an expression, so we need to copy the static context.
            ic = env.copy();
            for (Iterator iter = env.iterateExternalVariables(); iter.hasNext();) {
                XPathVariable var = (XPathVariable)iter.next();
                XPathVariable var2 = ic.declareVariable(var.getVariableQName());
                var2.setRequiredType(var.getRequiredType());
            }
        }
        try {
            XPathEvaluator eval = new XPathEvaluator(processor.getUnderlyingConfiguration());
            eval.setStaticContext(ic);
View Full Code Here

Examples of net.sf.saxon.sxpath.XPathVariable

     * @throws SaxonApiException if the variable has not been declared or if the type of the value
     * supplied does not conform to the required type that was specified when the variable was declared
     */

    public void setVariable(QName name, XdmValue value) throws SaxonApiException {
        XPathVariable var = null;
        StructuredQName qn = name.getStructuredQName();
        for (XPathVariable v : declaredVariables) {
            if (v.getVariableQName().equals(qn)) {
                var = v;
                break;
View Full Code Here

Examples of net.sf.saxon.sxpath.XPathVariable

     * @throws SaxonApiException if the requiredType is syntactically invalid or if it refers to namespace
     * prefixes or schema components that are not present in the static context
     */

    public void declareVariable(QName qname, ItemType itemType, OccurrenceIndicator occurrences) throws SaxonApiException {
        XPathVariable var = env.declareVariable(qname.getNamespaceURI(), qname.getLocalName());
        var.setRequiredType(
                SequenceType.makeSequenceType(
                        itemType.getUnderlyingItemType(), occurrences.getCardinality()));
        //declaredVariables.add(var);
    }
View Full Code Here

Examples of net.sf.saxon.sxpath.XPathVariable

     */

    public XPathSelector load() {
        ArrayList<XPathVariable> declaredVariables = new ArrayList<XPathVariable>();
        for (Iterator iter=env.iterateExternalVariables(); iter.hasNext();) {
            XPathVariable var = (XPathVariable)iter.next();
            declaredVariables.add(var);
        }
        return new XPathSelector(exp, declaredVariables);
    }
View Full Code Here

Examples of net.sf.saxon.sxpath.XPathVariable

     * the method returns null.</p>
     * @since 9.2
     */

    public ItemType getRequiredItemTypeForVariable(QName variableName) {
        XPathVariable var = env.getExternalVariable(variableName.getStructuredQName());
        if (var == null) {
            return null;
        } else {
            return new ConstructedItemType(var.getRequiredType().getPrimaryType(), processor);
        }
    }
View Full Code Here

Examples of net.sf.saxon.sxpath.XPathVariable

     * the method returns null.</p>
     * @since 9.2
     */

    public OccurrenceIndicator getRequiredCardinalityForVariable(QName variableName) {
        XPathVariable var = env.getExternalVariable(variableName.getStructuredQName());
        if (var == null) {
            return null;
        } else {
            return OccurrenceIndicator.getOccurrenceIndicator(var.getRequiredType().getCardinality());
        }
    }
View Full Code Here

Examples of net.sf.saxon.sxpath.XPathVariable

     *
     * @param qname The name of the variable, expressions as a QName
     */

    public void declareVariable(QName qname) {
        XPathVariable var = env.declareVariable(qname.getNamespaceURI(), qname.getLocalName());
        declaredVariables.add(var);
    }
View Full Code Here

Examples of net.sf.saxon.sxpath.XPathVariable

//        try {
//            type = parser.parseSequenceType(requiredType, env);
//        } catch (XPathException e) {
//            throw new SaxonApiException(e);
//        }
        XPathVariable var = env.declareVariable(qname.getNamespaceURI(), qname.getLocalName());
        var.setRequiredType(
                SequenceType.makeSequenceType(
                        itemType.getUnderlyingItemType(), occurrences.getCardinality()));
        declaredVariables.add(var);
    }
View Full Code Here

Examples of net.sf.saxon.sxpath.XPathVariable

     * @throws SaxonApiException if the variable has not been declared or if the type of the value
     * supplied does not conform to the required type that was specified when the variable was declared
     */

    public void setVariable(QName name, XdmValue value) throws SaxonApiException {
        XPathVariable var = null;
        for (XPathVariable v : declaredVariables) {
            if (v.getVariableQName().equals(name.getStructuredQName())) {
                var = v;
                break;
            }
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.