Package net.sf.saxon.s9api

Examples of net.sf.saxon.s9api.XdmSequenceIterator


    }

    public boolean processStartElement(XdmNode node) throws SaxonApiException {
        matcher.addStartElement(node);

        XdmSequenceIterator iter = node.axisIterator(Axis.ATTRIBUTE);
        while (iter.hasNext()) {
            XdmNode attr = (XdmNode) iter.next();
            if (!attrs.contains(attr.getNodeName())) {
                matcher.addAttribute(attr);
            }
        }
View Full Code Here


            TestSuiteResult result = runTest(root);
            results.add(result);
            return new TestSuiteResults(results);
        } else {
            String title = "";
            XdmSequenceIterator iter = root.axisIterator(Axis.CHILD, t_title);
            while (iter.hasNext()) {
                XdmNode test = (XdmNode) iter.next();
                title += test.getStringValue();
            }

            iter = root.axisIterator(Axis.CHILD, t_test);
            while (iter.hasNext()) {
                XdmNode test = (XdmNode) iter.next();
                TestSuiteResult result = runTest(test);
                results.add(result);
            }

            if (!"".equals(title)) {
View Full Code Here

    private String recursiveAnonymousName(XdmNode node) {
        if (node.getParent().getNodeKind() == XdmNodeKind.DOCUMENT) {
            return "!1";
        } else {
            XdmSequenceIterator iter = node.axisIterator(Axis.PRECEDING_SIBLING);
            int count = 1;
            while (iter.hasNext()) {
                XdmNode pnode = (XdmNode) iter.next();
                if (pnode.getNodeKind() == XdmNodeKind.ELEMENT) {
                    count++;
                }
            }
            return anonymousName(node.getParent()) + "." + count;
View Full Code Here

                        if (href != null) {
                            add(input, port, href);
                        } else {
                            // Make sure that we have a document
                            Vector<XdmValue> nodes = new Vector<XdmValue>();
                            XdmSequenceIterator iter = node.axisIterator(Axis.CHILD);
                            while (iter.hasNext()) {
                                nodes.add(iter.next());
                            }
                            XdmDestination dest = new XdmDestination();
                            S9apiUtils.writeXdmValue(runtime, nodes, dest, node.getBaseURI());
                            add(input, port, dest.getXdmNode());
                        }
View Full Code Here

            } else {
                startDocument(node.getBaseURI());
            }

            if (!match || processChildren) {
                XdmSequenceIterator iter = node.axisIterator(Axis.CHILD);
                while (iter.hasNext()) {
                    XdmNode child = (XdmNode) iter.next();
                    traverse(child);
                }
            }

            if (match) {
                processor.processEndDocument(node);
            } else {
                endDocument();
            }
        } else if (node.getNodeKind() == XdmNodeKind.ELEMENT) {
            if (match) {
                processChildren = processor.processStartElement(node);
                saw = 0;
            } else {
                addStartElement(node);
            }

            if (!match) {
                XdmSequenceIterator iter = node.axisIterator(Axis.ATTRIBUTE);

                // Walk through the attributes twice, processing all the *NON* matches first.
                // That way if a matching node renames an attribute, it can replace any non-matching
                // attribute with the same name.
                while (iter.hasNext()) {
                    XdmNode child = (XdmNode) iter.next();
                    if (!matches(child)) {
                        traverse(child);
                    }
                }

                iter = node.axisIterator(Axis.ATTRIBUTE);
                while (iter.hasNext()) {
                    XdmNode child = (XdmNode) iter.next();
                    if (matches(child)) {
                        traverse(child);
                    }
                }

                receiver.startContent();
            }

            if (!match || processChildren) {
                XdmSequenceIterator iter = node.axisIterator(Axis.CHILD);
                while (iter.hasNext()) {
                    XdmNode child = (XdmNode) iter.next();
                    traverse(child);
                }
            }

            if (match) {
View Full Code Here

            count++;
        }

        if (node.getNodeKind() == XdmNodeKind.DOCUMENT) {
            if (!match || deep) {
                XdmSequenceIterator iter = node.axisIterator(Axis.CHILD);
                while (iter.hasNext()) {
                    XdmNode child = (XdmNode) iter.next();
                    traverse(child, deep);
                }
            }
        } else if (node.getNodeKind() == XdmNodeKind.ELEMENT) {
            if (!match || deep) {
                XdmSequenceIterator iter = node.axisIterator(Axis.ATTRIBUTE);
                while (iter.hasNext()) {
                    XdmNode child = (XdmNode) iter.next();
                    traverse(child, deep);
                }
                iter = node.axisIterator(Axis.CHILD);
                while (iter.hasNext()) {
                    XdmNode child = (XdmNode) iter.next();
                    traverse(child, deep);
                }
            }
        } else {
            //nop
View Full Code Here

            matcher.addStartElement(nameCode, inode.getSchemaType(), newNS);
        }

        if (!"elements".equals(applyTo)) {
            XdmSequenceIterator iter = node.axisIterator(Axis.ATTRIBUTE);
            while (iter.hasNext()) {
                XdmNode attr = (XdmNode) iter.next();
                inode = attr.getUnderlyingNode();
                NodeName nameCode = new NameOfNode(inode);
                String pfx = nameCode.getPrefix();
                String uri = nameCode.getURI();
View Full Code Here

            }
        }

        public void setDescription(XdmNode desc) {
            if (desc != null) {
                XdmSequenceIterator iter = desc.axisIterator(Axis.CHILD);
                description = new Vector<XdmNode> ();
                while (iter.hasNext()) {
                    XdmNode node = (XdmNode) iter.next();
                    HashSet<String> prefixes = new HashSet<String> ();
                    XdmSequenceIterator nsiter = node.axisIterator(Axis.NAMESPACE);
                    while (nsiter.hasNext()){
                        XdmNode nsnode = (XdmNode) nsiter.next();
                        if (nsnode.getNodeName() != null) {
                            String prefix = nsnode.getNodeName().getLocalName();
                            String uri = nsnode.getStringValue();
                            if (!"http://www.w3.org/1999/xhtml".equals(uri)
                                && !"xml".equals(prefix)) {
View Full Code Here

        if (nodeValue == null) {
            return false;
        }

        XdmSequenceIterator iter = node.axisIterator(Axis.FOLLOWING_SIBLING);

        while (iter.hasNext()) {
            XdmNode chk = (XdmNode) iter.next();

            boolean skippable
                    = (chk.getNodeKind() == XdmNodeKind.COMMENT
                       || chk.getNodeKind() == XdmNodeKind.PROCESSING_INSTRUCTION);
View Full Code Here

    }

    // extract fields from query result sequence
    private boolean addRecordValues(XdmNode node, Axis axis, XdmNodeKind nodeTest, Record record) {
      boolean isEmpty = true;
      XdmSequenceIterator iter = node.axisIterator(axis);
      while (iter.hasNext()) {
        XdmNode child = (XdmNode) iter.next();
        if (child.getNodeKind() == nodeTest) {
          String strValue = child.getStringValue();
          if (strValue.length() > 0) {
            record.put(child.getNodeName().getLocalName(), strValue);
            isEmpty = false;
View Full Code Here

TOP

Related Classes of net.sf.saxon.s9api.XdmSequenceIterator

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.