Package client.net.sf.saxon.ce.om

Examples of client.net.sf.saxon.ce.om.NodeInfo


        return true;
    }

    public void validate(Declaration decl) throws XPathException {

        NodeInfo parent = getParent();
        global = (parent instanceof XSLStylesheet);

        if (!((parent instanceof StyleElement) && ((StyleElement)parent).mayContainParam(null))) {
            compileError("xsl:param must be immediately within a template, function or stylesheet", "XTSE0010");
        }

        if (!global) {
            AxisIterator preceding = iterateAxis(Axis.PRECEDING_SIBLING);
            while (true) {
                NodeInfo node = (NodeInfo)preceding.next();
                if (node == null) {
                    break;
                }
                if (node instanceof XSLParam) {
                    if (this.getVariableQName().equals(((XSLParam)node).getVariableQName())) {
                        compileError("The name of the parameter is not unique", "XTSE0580");
                    }
                } else if (node instanceof StyleElement) {
                    compileError("xsl:param must not be preceded by other instructions", "XTSE0010");
                } else {
                    // it must be a text node; allow it if all whitespace
                    if (!Whitespace.isWhite(node.getStringValueCS())) {
                        compileError("xsl:param must not be preceded by text", "XTSE0010");
                    }
                }
            }
View Full Code Here


        StyleElement previousElement = sourceElement;

        AxisIterator kids = sourceElement.iterateAxis(Axis.CHILD);

        while (true) {
            NodeInfo child = (NodeInfo) kids.next();
            if (child == null) {
                break;
            }
            if (child.getNodeKind() == Type.TEXT) {
                // in an embedded stylesheet, white space nodes may still be there
                if (!Whitespace.isWhite(child.getStringValueCS())) {
                    previousElement.compileError(
                            "No character data is allowed between top-level elements", "XTSE0120");
                }

            } else if (child instanceof DataElement) {
View Full Code Here

    * @param id the required ID value
    * @return the element with the given ID value, or null if there is none.
    */

    public NodeInfo selectID(String id) {
        NodeInfo n = ((DocumentInfo)node).selectID(id);
        if (n==null) {
            return null;
        } else {
            return makeWrapper(n, this, null);
        }
View Full Code Here

     */

    private static boolean findPreserveSpace(DocumentInfo doc) {
        AxisIterator iter = doc.iterateAxis(Axis.DESCENDANT, NodeKindTest.ELEMENT);
        while (true) {
            NodeInfo node = (NodeInfo)iter.next();
            if (node == null) {
                return false;
            }
            String val = Navigator.getAttributeValue(node, NamespaceConstant.XML, "space");
            if ("preserve".equals(val)) {
View Full Code Here

        // need to determine whether HTML, XHTML or neither so as to control case of node names
        // and distinguish other XML/HTML behaviours - like SelectID
        try {
            AxisIterator iter = this.iterateAxis(Axis.CHILD);
            while (true) {
                NodeInfo n = (NodeInfo)iter.next();
                if (n == null) {
                  break;
                } else if (n.getNodeKind() == Type.ELEMENT) {
//                  String uri = n.getURI();
//                  if (uri != null && uri.length() > 0) {
//                    htmlType = (uri.equals(NamespaceConstant.XHTML))? DocType.XHTML : DocType.NONHTML;
//                    return;
//                  }
                  String rawLocal = ((HTMLNodeWrapper)n).getRawLocalName().toLowerCase();
                  if (rawLocal.equals("html")) {
                    NamespaceBinding[] nb = n.getDeclaredNamespaces(null);
                    htmlType = DocType.HTML;
                    for (NamespaceBinding nBinding: nb) {
                      if (nBinding.getURI().equals(NamespaceConstant.XHTML)) {
                        htmlType = DocType.XHTML;
                        break;
View Full Code Here

        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

            } else {
                idIndex = new HashMap();
                AxisIterator iter = iterateAxis(Axis.DESCENDANT, NodeKindTest.ELEMENT);
                boolean useNS = isNSok(node);
                while (true) {
                    NodeInfo node = (NodeInfo)iter.next();
                    if (node == null) {
                        break;
                    }
                    Node testNode = (Node)((HTMLNodeWrapper)node).getUnderlyingNode();
                    String xmlId = (useNS)? getXmlIdNS(testNode) : getXmlId(testNode);
View Full Code Here

    public static LocalOrderComparer getInstance() {
        return instance;
    }

    public int compare(NodeInfo a, NodeInfo b) {
        NodeInfo n1 = (NodeInfo)a;
        NodeInfo n2 = (NodeInfo)b;
        return n1.compareOrder(n2);
    }
View Full Code Here

    */

    public boolean matches(NodeInfo e, XPathContext context) throws XPathException {
        SequenceIterator iter = expression.iterate(context);
        while (true) {
            NodeInfo node = (NodeInfo)iter.next();
            if (node == null) {
                return false;
            }
            if (node.isSameNodeInfo(e)) {
                return true;
            }
        }
    }
View Full Code Here

        }


        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

TOP

Related Classes of client.net.sf.saxon.ce.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.