Package org.pdf4j.saxon.om

Examples of org.pdf4j.saxon.om.NodeInfo


        if (saxonIterate == null) {
            compileError("saxon:continue must be a descendant of a saxon:iterate instruction");
        }
        AxisIterator kids = iterateAxis(Axis.CHILD);
        while (true) {
            NodeInfo child = (NodeInfo)kids.next();
            if (child == null) {
                break;
            }
            if (child instanceof XSLWithParam) {
                // OK;
            } else if (child instanceof XSLFallback && mayContainFallback()) {
                // xsl:fallback is not allowed on xsl:call-template, but is allowed on saxon:call-template (cheat!)
            } else if (child.getNodeKind() == Type.TEXT) {
                    // with xml:space=preserve, white space nodes may still be there
                if (!Whitespace.isWhite(child.getStringValueCS())) {
                    compileError("No character data is allowed within saxon:continue", "XTSE0010");
                }
            } else {
                compileError("Child element " + Err.wrap(child.getDisplayName(), Err.ELEMENT) +
                        " is not allowed within saxon:continue", "XTSE0010");
            }
        }

    }
View Full Code Here


        // of the containing saxon:iterate instruction

        if (saxonIterate != null) {
            AxisIterator declaredParams = saxonIterate.iterateAxis(Axis.CHILD);
            while(true) {
                NodeInfo param = (NodeInfo)declaredParams.next();
                if (param == null) {
                    break;
                }
                if (param instanceof XSLParam && ((XSLParam)param).isRequiredParam()) {
                    AxisIterator actualParams = iterateAxis(Axis.CHILD);
                    boolean ok = false;
                    while(true) {
                        NodeInfo withParam = (NodeInfo)actualParams.next();
                        if (withParam == null) {
                            break;
                        }
                        if (withParam instanceof XSLWithParam &&
                                ((XSLWithParam)withParam).getVariableQName().equals(
                                    ((XSLParam)param).getVariableQName())) {
                            ok = true;
                            break;
                        }
                    }
                    if (!ok) {
                        compileError("No value supplied for required parameter " +
                                Err.wrap(((XSLParam)param).getVariableDisplayName(), Err.VARIABLE), "XTSE0690");
                    }
                }
            }


            // check that every supplied parameter is declared in the saxon:iterate instruction

            AxisIterator actualParams = iterateAxis(Axis.CHILD);
            while(true) {
                NodeInfo w = (NodeInfo)actualParams.next();
                if (w == null) {
                    break;
                }
                if (w instanceof XSLWithParam && !((XSLWithParam)w).isTunnelParam()) {
                    XSLWithParam withParam = (XSLWithParam)w;
                    AxisIterator formalParams = saxonIterate.iterateAxis(Axis.CHILD);
                    boolean ok = false;
                    while(true) {
                        NodeInfo param = (NodeInfo)formalParams.next();
                        if (param == null) {
                            break;
                        }
                        if (param instanceof XSLParam &&
                                ((XSLParam)param).getVariableQName().equals(withParam.getVariableQName())) {
View Full Code Here

    public static SequenceIterator leading (
                     XPathContext context,
                     SequenceIterator ns1, SequenceIterator ns2) throws XPathException {

        NodeInfo first = null;

        // Find the first node in ns2 (in document order)

        GlobalOrderComparer comparer = GlobalOrderComparer.getInstance();
        while (true) {
            Item item = ns2.next();
            if (item == null) {
                if (first == null) {
                    return ns1;
                }
                break;
            }
            if (item instanceof NodeInfo) {
                NodeInfo node = (NodeInfo)item;
                if (first==null) {
                    first = node;
                } else {
                    if (comparer.compare(node, first) < 0) {
                        first = node;
View Full Code Here

            AtomicValue value = (AtomicValue)item.getUnderlyingValue();

            AtomicType type = (AtomicType)value.getItemType(config.getTypeHierarchy());
            return new ItemType(type, processor);
        } else {
            NodeInfo node = (NodeInfo)item.getUnderlyingValue();
            int kind = node.getNodeKind();
            int fp = node.getFingerprint();
            if (fp == -1) {
                return new ItemType(NodeKindTest.makeNodeKindTest(kind), processor);
            } else {
                return new ItemType(new NameTest(kind, fp, config.getNamePool()), processor);
            }
View Full Code Here

        as.setLineNumbering(lineNumbering);
        if (source.getSystemId() == null && baseURI != null) {
            source.setSystemId(baseURI.toString());
        }
        try {
            NodeInfo doc = config.buildDocument(as);
            return new XdmNode(doc);
        } catch (XPathException e) {
            throw new SaxonApiException(e);
        }
    }                                                          
View Full Code Here

     */

    public XdmNode wrap(Object node) throws IllegalArgumentException {
         try {
             JPConverter converter = JPConverter.allocate(node.getClass(), config);
             NodeInfo nodeInfo = (NodeInfo)converter.convert(node, new EarlyEvaluationContext(config, null));
             return (XdmNode)XdmItem.wrapItem(nodeInfo);
         } catch (XPathException e) {
             throw new IllegalArgumentException(e.getMessage());
         }
    }
View Full Code Here

        if (controller.getExecutable().stripsInputTypeAnnotations()) {
            s = controller.getConfiguration().getAnnotationStripper(s);
        }
        try {
            new Sender(controller.makePipelineConfiguration()).send(source, s);
            NodeInfo node = b.getCurrentRoot();
            b.reset();
            return node;
        } catch (XPathException err) {
            throw new XPathException(err);
        }
View Full Code Here

        try {
            if (expression.isUpdateQuery()) {
                Set docs = expression.runUpdate(context);
                updatedDocuments = new HashSet();
                for (Iterator iter = docs.iterator(); iter.hasNext();) {
                    NodeInfo root = (NodeInfo)iter.next();
                    updatedDocuments.add((XdmNode)XdmNode.wrapItem(root));
                }
            } else {
                if (destination == null) {
                    throw new IllegalStateException("No destination supplied");
View Full Code Here

        AxisIterator iter = node.iterateAxis(Axis.CHILD);
        // The match is true if there is exactly one element node child, no text node
        // children, and the element node matches the element test.
        boolean found = false;
        while (true) {
            NodeInfo n = (NodeInfo)iter.next();
            if (n==null) {
                return found;
            }
            int kind = n.getNodeKind();
            if (kind==Type.TEXT) {
                return false;
            } else if (kind==Type.ELEMENT) {
                if (found) {
                    return false;
View Full Code Here

    }

    public void validate() throws XPathException {
        AxisIterator kids = iterateAxis(Axis.CHILD);
        while(true) {
            NodeInfo curr = (NodeInfo)kids.next();
            if (curr == null) {
                break;
            }
            if (curr instanceof XSLWhen) {
                if (otherwise!=null) {
View Full Code Here

TOP

Related Classes of org.pdf4j.saxon.om.NodeInfo

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.