Package org.pdf4j.saxon.om

Examples of org.pdf4j.saxon.om.AxisIterator


    public void validate() throws XPathException {
        if (select != null && hasChildNodes()) {
            String errorCode = getErrorCodeForSelectPlusContent();
            compileError("An " + getDisplayName() + " element with a select attribute must be empty", errorCode);
        }
        AxisIterator kids = iterateAxis(Axis.CHILD);
        NodeInfo first = (NodeInfo)kids.next();
        if (select == null) {
            if (first == null) {
                // there are no child nodes and no select attribute
                //stringValue = "";
                select = new StringLiteral(StringValue.EMPTY_STRING);
            } else {
                if (kids.next() == null) {
                    // there is exactly one child node
                    if (first.getNodeKind() == Type.TEXT) {
                        // it is a text node: optimize for this case
                        select = new StringLiteral(first.getStringValue());
                    }
View Full Code Here


    public void validate() throws XPathException {
        StyleElement parent = (StyleElement)getParent();
        if (!(parent instanceof SaxonIterate)) {
            compileError("saxon:finally is not allowed as a child of " + parent.getDisplayName(), "XTSE0010");
        }
        AxisIterator sibs = iterateAxis(Axis.FOLLOWING_SIBLING, NodeKindTest.ELEMENT);
        while (true) {
            NodeInfo sib = (NodeInfo)sibs.next();
            if (sib == null) {
                break;
            }
            if (!(sib instanceof XSLFallback)) {
                compileError("saxon:finally must be the last child of saxon:iterate", "XTSE0010");
View Full Code Here

    }

    public void validate() throws XPathException {
        super.validate();
        connection = typeCheck("connection", connection);
        AxisIterator kids = iterateAxis(Axis.CHILD);
        while(true) {
            NodeInfo curr = (NodeInfo)kids.next();
            if (curr == null) {
                break;
            }
            if (curr instanceof SQLColumn) {
                // OK
View Full Code Here

        // Collect names of columns to be added

        StringBuffer statement = new StringBuffer(120);
        statement.append("INSERT INTO " + table + " (");

        AxisIterator kids = iterateAxis(Axis.CHILD);
        NodeInfo child;
    int cols = 0;
    while (true) {
            child = (NodeInfo)kids.next();
            if (child == null) {
                break;
            }
        if (child instanceof SQLColumn) {
          if (cols++ > 0statement.append(',');
View Full Code Here

    }

    public List getColumnInstructions(Executable exec) throws XPathException {
        List list = new ArrayList(10);

        AxisIterator kids = iterateAxis(Axis.CHILD);
        NodeInfo child;
    while (true) {
            child = (NodeInfo)kids.next();
            if (child == null) {
                break;
            }
        if (child instanceof SQLColumn) {
          list.add(((SQLColumn)child).compile(exec));
View Full Code Here

    public Element getDocumentElement() {
        NodeInfo root = node.getDocumentRoot();
        if (root==null) {
            return null;
        }
        AxisIterator children =
            root.iterateAxis(Axis.CHILD, NodeKindTest.ELEMENT);
        return (Element)wrap((NodeInfo)children.next());
    }   
View Full Code Here

            root.iterateAxis(Axis.CHILD, NodeKindTest.ELEMENT);
        return (Element)wrap((NodeInfo)children.next());
    }   

     protected static NodeList getElementsByTagName(NodeInfo node, String tagname) {
         AxisIterator allElements = node.iterateAxis(Axis.DESCENDANT);
         ArrayList nodes = new ArrayList(100);
         while(true) {
             NodeInfo next = (NodeInfo)allElements.next();
             if (next == null) {
                 break;
             }
             if (next.getNodeKind()==Type.ELEMENT) {
                 if (tagname.equals("*") || tagname.equals(next.getDisplayName())) {
View Full Code Here

         return getElementsByTagNameNS(node, namespaceURI, localName);
     }

     public static NodeList getElementsByTagNameNS(NodeInfo node, String namespaceURI, String localName) {
         String ns = (namespaceURI==null ? "" : namespaceURI);
         AxisIterator allElements = node.iterateAxis(Axis.DESCENDANT);
         ArrayList nodes = new ArrayList(100);
         while(true) {
             NodeInfo next = (NodeInfo)allElements.next();
             if (next == null) {
                 break;
             }
             if (next.getNodeKind()==Type.ELEMENT) {
                 if ((ns.equals("*") || ns.equals(next.getURI())) &&
View Full Code Here

    public void validate() throws XPathException {
        validatePosition();
        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;
View Full Code Here

    public void postValidate() throws XPathException {
        // check that a parameter is supplied for each required parameter
        // 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

TOP

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

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.