Examples of AxisIterator


Examples of client.net.sf.saxon.ce.tree.iter.AxisIterator

    public CharSequence getStringValueCS() {
        // Might not be the same as the string value of the underlying node because of space stripping
        switch (getNodeKind()) {
            case Type.DOCUMENT:
            case Type.ELEMENT:
                AxisIterator iter = iterateAxis(Axis.DESCENDANT, NodeKindTest.makeNodeKindTest(Type.TEXT));
                FastStringBuffer sb = new FastStringBuffer(FastStringBuffer.SMALL);
                while(true) {
                    NodeInfo it = (NodeInfo)iter.next();
                    if (it == null) {
                        break;
                    }
                    sb.append(it.getStringValueCS());
                }
View Full Code Here

Examples of client.net.sf.saxon.ce.tree.iter.AxisIterator

        } catch (XPathException err) {
            throw new RESyntaxException("Unable to read unicodeBlocks.xml file");
        }


        AxisIterator iter = doc.iterateAxis(Axis.DESCENDANT, new NameTest(Type.ELEMENT, "", "block", config.getNamePool()));
        while (true) {
            NodeInfo item = (NodeInfo)iter.next();
            if (item == null) {
                break;
            }
            String blockName = normalizeBlockName(Navigator.getAttributeValue(item, "", "name"));
            IntSet range = null;
            AxisIterator ranges = item.iterateAxis(Axis.CHILD, NodeKindTest.ELEMENT);
            while (true) {
                NodeInfo rangeElement = (NodeInfo)ranges.next();
                if (rangeElement == null) {
                    break;
                }
                int from = Integer.parseInt(Navigator.getAttributeValue(rangeElement, "", "from").substring(2), 16);
                int to = Integer.parseInt(Navigator.getAttributeValue(rangeElement, "", "to").substring(2), 16);
View Full Code Here

Examples of client.net.sf.saxon.ce.tree.iter.AxisIterator

                    return SingletonIterator.makeIterator(doc);
                } else {
                    return EmptyIterator.getInstance();
                }
            case Type.ATTRIBUTE: {
                AxisIterator allElements = doc.iterateAxis(Axis.DESCENDANT, NodeKindTest.ELEMENT);
                MappingFunction atts = new MappingFunction() {
                    public SequenceIterator map(Item item) {
                        return ((NodeInfo)item).iterateAxis(Axis.ATTRIBUTE);
                    }
                };
                SequenceIterator allAttributes = new MappingIterator(allElements, atts);
                ItemMappingFunction test = new ItemMappingFunction() {
                    public Item mapItem(Item item) throws XPathException {
                        if ((matches((NodeInfo)item, context))) {
                            return item;
                        } else {
                            return null;
                        }
                    }
                };
                return new ItemMappingIterator(allAttributes, test);
            }
            case Type.ELEMENT:
            case Type.COMMENT:
            case Type.TEXT:
            case Type.PROCESSING_INSTRUCTION: {
                AxisIterator allChildren = doc.iterateAxis(Axis.DESCENDANT, NodeKindTest.makeNodeKindTest(kind));
                ItemMappingFunction test = new ItemMappingFunction() {
                    public Item mapItem(Item item) throws XPathException {
                        if ((matches((NodeInfo)item, context))) {
                            return item;
                        } else {
                            return null;
                        }
                    }
                };
                return new ItemMappingIterator(allChildren, test);
            }
            case Type.NODE: {
                AxisIterator allChildren = doc.iterateAxis(Axis.DESCENDANT);
                MappingFunction attsOrSelf = new MappingFunction() {
                    public SequenceIterator map(Item item) {
                        return new PrependIterator((NodeInfo)item, ((NodeInfo)item).iterateAxis(Axis.ATTRIBUTE));
                    }
                };
View Full Code Here

Examples of client.net.sf.saxon.ce.tree.iter.AxisIterator


    public void validate(Declaration decl) throws XPathException {
        //checkWithinTemplate();

        AxisIterator kids = iterateAxis(Axis.CHILD);
        while(true) {
            NodeInfo curr = (NodeInfo)kids.next();
            if (curr == null) {
                break;
            }
            if (curr instanceof XSLFallback) {
                // no-op
View Full Code Here

Examples of client.net.sf.saxon.ce.tree.iter.AxisIterator

                getConfiguration().issueWarning("Match pattern cannot match any nodes");
            }
        }

        // See if there are any required parameters.
        AxisIterator kids = iterateAxis(Axis.CHILD);
        while(true) {
            NodeInfo param = (NodeInfo)kids.next();
            if (param == null) {
                break;
            }
            if (param instanceof XSLParam && ((XSLParam)param).isRequiredParam()) {
                hasRequiredParams = true;
View Full Code Here

Examples of client.net.sf.saxon.ce.tree.iter.AxisIterator

    public boolean matches(NodeInfo node) {
        if (node.getNodeKind() != Type.DOCUMENT) {
            return false;
        }
        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) {
View Full Code Here

Examples of client.net.sf.saxon.ce.tree.iter.AxisIterator

        }
        if (getParent().getNodeKind() != Type.DOCUMENT) {
            compileError(getDisplayName() + " must be the outermost element", "XTSE0010");
        }

        AxisIterator kids = iterateAxis(Axis.CHILD);
        while(true) {
            NodeInfo curr = (NodeInfo)kids.next();
            if (curr == null) break;
            if (curr.getNodeKind() == Type.TEXT ||
                    (curr instanceof StyleElement && ((StyleElement)curr).isDeclaration()) ||
                    curr instanceof DataElement) {
                // all is well
View Full Code Here

Examples of client.net.sf.saxon.ce.tree.iter.AxisIterator

     */

    public void processAllAttributes() throws XPathException {
        processDefaultCollationAttribute("");
        prepareAttributes();
        AxisIterator iter = iterateAxis(Axis.CHILD);
        while (true) {
            NodeInfo node = (NodeInfo)iter.next();
            if (node == null) {
                break;
            }
            if (node instanceof StyleElement) {
                try {
View Full Code Here

Examples of client.net.sf.saxon.ce.tree.iter.AxisIterator

            mode = getPreparedStylesheet().getRuleManager().getMode(modeName, true);
        }

        // handle sorting if requested

        AxisIterator kids = iterateAxis(Axis.CHILD);
        while (true) {
            NodeInfo child = (NodeInfo)kids.next();
            if (child == null) {
                break;
            }
            if (child instanceof XSLSort) {
                // no-op
View Full Code Here

Examples of net.sf.saxon.om.AxisIterator

    doc.setBaseURI(node.getBaseURI());
   
    boolean hasRootElement = false;
    int i = 0;
    NodeInfo next;
    AxisIterator iter = node.iterateAxis(Axis.CHILD);
    while ((next = (NodeInfo) iter.next()) != null) {
      Node child = convertNodeInfo(next);
      if (child instanceof Element) { // replace fake root with real root
        if (hasRootElement) throw new IllegalAddException(
          "A XOM document must not have more than one root element.");
        doc.setRootElement((Element) child);
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.