summaryrefslogtreecommitdiff
path: root/libjava/classpath/external/w3c_dom/org/w3c/dom/xpath
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /libjava/classpath/external/w3c_dom/org/w3c/dom/xpath
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'libjava/classpath/external/w3c_dom/org/w3c/dom/xpath')
-rw-r--r--libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathEvaluator.java134
-rw-r--r--libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathException.java39
-rw-r--r--libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathExpression.java65
-rw-r--r--libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathNSResolver.java34
-rw-r--r--libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathNamespace.java67
-rw-r--r--libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathResult.java214
6 files changed, 553 insertions, 0 deletions
diff --git a/libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathEvaluator.java b/libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathEvaluator.java
new file mode 100644
index 000000000..848c67329
--- /dev/null
+++ b/libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathEvaluator.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom.xpath;
+
+import org.w3c.dom.Node;
+import org.w3c.dom.DOMException;
+
+/**
+ * The evaluation of XPath expressions is provided by
+ * <code>XPathEvaluator</code>. In a DOM implementation which supports the
+ * XPath 3.0 feature, as described above, the <code>XPathEvaluator</code>
+ * interface will be implemented on the same object which implements the
+ * <code>Document</code> interface permitting it to be obtained by the usual
+ * binding-specific method such as casting or by using the DOM Level 3
+ * getInterface method. In this case the implementation obtained from the
+ * Document supports the XPath DOM module and is compatible with the XPath
+ * 1.0 specification.
+ * <p>Evaluation of expressions with specialized extension functions or
+ * variables may not work in all implementations and is, therefore, not
+ * portable. <code>XPathEvaluator</code> implementations may be available
+ * from other sources that could provide specific support for specialized
+ * extension functions or variables as would be defined by other
+ * specifications.
+ * <p>See also the <a href='http://www.w3.org/TR/2004/NOTE-DOM-Level-3-XPath-20040226'>Document Object Model (DOM) Level 3 XPath Specification</a>.
+ */
+public interface XPathEvaluator {
+ /**
+ * Creates a parsed XPath expression with resolved namespaces. This is
+ * useful when an expression will be reused in an application since it
+ * makes it possible to compile the expression string into a more
+ * efficient internal form and preresolve all namespace prefixes which
+ * occur within the expression.
+ * @param expression The XPath expression string to be parsed.
+ * @param resolver The <code>resolver</code> permits translation of all
+ * prefixes, including the <code>xml</code> namespace prefix, within
+ * the XPath expression into appropriate namespace URIs. If this is
+ * specified as <code>null</code>, any namespace prefix within the
+ * expression will result in <code>DOMException</code> being thrown
+ * with the code <code>NAMESPACE_ERR</code>.
+ * @return The compiled form of the XPath expression.
+ * @exception XPathException
+ * INVALID_EXPRESSION_ERR: Raised if the expression is not legal
+ * according to the rules of the <code>XPathEvaluator</code>.
+ * @exception DOMException
+ * NAMESPACE_ERR: Raised if the expression contains namespace prefixes
+ * which cannot be resolved by the specified
+ * <code>XPathNSResolver</code>.
+ */
+ public XPathExpression createExpression(String expression,
+ XPathNSResolver resolver)
+ throws XPathException, DOMException;
+
+ /**
+ * Adapts any DOM node to resolve namespaces so that an XPath expression
+ * can be easily evaluated relative to the context of the node where it
+ * appeared within the document. This adapter works like the DOM Level 3
+ * method <code>lookupNamespaceURI</code> on nodes in resolving the
+ * namespaceURI from a given prefix using the current information
+ * available in the node's hierarchy at the time lookupNamespaceURI is
+ * called. also correctly resolving the implicit xml prefix.
+ * @param nodeResolver The node to be used as a context for namespace
+ * resolution.
+ * @return <code>XPathNSResolver</code> which resolves namespaces with
+ * respect to the definitions in scope for a specified node.
+ */
+ public XPathNSResolver createNSResolver(Node nodeResolver);
+
+ /**
+ * Evaluates an XPath expression string and returns a result of the
+ * specified type if possible.
+ * @param expression The XPath expression string to be parsed and
+ * evaluated.
+ * @param contextNode The <code>context</code> is context node for the
+ * evaluation of this XPath expression. If the XPathEvaluator was
+ * obtained by casting the <code>Document</code> then this must be
+ * owned by the same document and must be a <code>Document</code>,
+ * <code>Element</code>, <code>Attribute</code>, <code>Text</code>,
+ * <code>CDATASection</code>, <code>Comment</code>,
+ * <code>ProcessingInstruction</code>, or <code>XPathNamespace</code>
+ * node. If the context node is a <code>Text</code> or a
+ * <code>CDATASection</code>, then the context is interpreted as the
+ * whole logical text node as seen by XPath, unless the node is empty
+ * in which case it may not serve as the XPath context.
+ * @param resolver The <code>resolver</code> permits translation of all
+ * prefixes, including the <code>xml</code> namespace prefix, within
+ * the XPath expression into appropriate namespace URIs. If this is
+ * specified as <code>null</code>, any namespace prefix within the
+ * expression will result in <code>DOMException</code> being thrown
+ * with the code <code>NAMESPACE_ERR</code>.
+ * @param type If a specific <code>type</code> is specified, then the
+ * result will be returned as the corresponding type.For XPath 1.0
+ * results, this must be one of the codes of the
+ * <code>XPathResult</code> interface.
+ * @param result The <code>result</code> specifies a specific result
+ * object which may be reused and returned by this method. If this is
+ * specified as <code>null</code>or the implementation does not reuse
+ * the specified result, a new result object will be constructed and
+ * returned.For XPath 1.0 results, this object will be of type
+ * <code>XPathResult</code>.
+ * @return The result of the evaluation of the XPath expression.For XPath
+ * 1.0 results, this object will be of type <code>XPathResult</code>.
+ * @exception XPathException
+ * INVALID_EXPRESSION_ERR: Raised if the expression is not legal
+ * according to the rules of the <code>XPathEvaluator</code>i
+ * <br>TYPE_ERR: Raised if the result cannot be converted to return the
+ * specified type.
+ * @exception DOMException
+ * NAMESPACE_ERR: Raised if the expression contains namespace prefixes
+ * which cannot be resolved by the specified
+ * <code>XPathNSResolver</code>.
+ * <br>WRONG_DOCUMENT_ERR: The Node is from a document that is not
+ * supported by this <code>XPathEvaluator</code>.
+ * <br>NOT_SUPPORTED_ERR: The Node is not a type permitted as an XPath
+ * context node or the request type is not permitted by this
+ * <code>XPathEvaluator</code>.
+ */
+ public Object evaluate(String expression,
+ Node contextNode,
+ XPathNSResolver resolver,
+ short type,
+ Object result)
+ throws XPathException, DOMException;
+
+}
diff --git a/libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathException.java b/libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathException.java
new file mode 100644
index 000000000..6b13cdf00
--- /dev/null
+++ b/libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathException.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom.xpath;
+
+/**
+ * A new exception has been created for exceptions specific to these XPath
+ * interfaces.
+ * <p>See also the <a href='http://www.w3.org/TR/2004/NOTE-DOM-Level-3-XPath-20040226'>Document Object Model (DOM) Level 3 XPath Specification</a>.
+ */
+public class XPathException extends RuntimeException {
+ public XPathException(short code, String message) {
+ super(message);
+ this.code = code;
+ }
+ public short code;
+ // XPathExceptionCode
+ /**
+ * If the expression has a syntax error or otherwise is not a legal
+ * expression according to the rules of the specific
+ * <code>XPathEvaluator</code> or contains specialized extension
+ * functions or variables not supported by this implementation.
+ */
+ public static final short INVALID_EXPRESSION_ERR = 51;
+ /**
+ * If the expression cannot be converted to return the specified type.
+ */
+ public static final short TYPE_ERR = 52;
+
+}
diff --git a/libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathExpression.java b/libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathExpression.java
new file mode 100644
index 000000000..ab5d28c43
--- /dev/null
+++ b/libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathExpression.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom.xpath;
+
+import org.w3c.dom.Node;
+import org.w3c.dom.DOMException;
+
+/**
+ * The <code>XPathExpression</code> interface represents a parsed and resolved
+ * XPath expression.
+ * <p>See also the <a href='http://www.w3.org/TR/2004/NOTE-DOM-Level-3-XPath-20040226'>Document Object Model (DOM) Level 3 XPath Specification</a>.
+ */
+public interface XPathExpression {
+ /**
+ * Evaluates this XPath expression and returns a result.
+ * @param contextNode The <code>context</code> is context node for the
+ * evaluation of this XPath expression.If the XPathEvaluator was
+ * obtained by casting the <code>Document</code> then this must be
+ * owned by the same document and must be a <code>Document</code>,
+ * <code>Element</code>, <code>Attribute</code>, <code>Text</code>,
+ * <code>CDATASection</code>, <code>Comment</code>,
+ * <code>ProcessingInstruction</code>, or <code>XPathNamespace</code>
+ * node.If the context node is a <code>Text</code> or a
+ * <code>CDATASection</code>, then the context is interpreted as the
+ * whole logical text node as seen by XPath, unless the node is empty
+ * in which case it may not serve as the XPath context.
+ * @param type If a specific <code>type</code> is specified, then the
+ * result will be coerced to return the specified type relying on
+ * XPath conversions and fail if the desired coercion is not possible.
+ * This must be one of the type codes of <code>XPathResult</code>.
+ * @param result The <code>result</code> specifies a specific result
+ * object which may be reused and returned by this method. If this is
+ * specified as <code>null</code>or the implementation does not reuse
+ * the specified result, a new result object will be constructed and
+ * returned.For XPath 1.0 results, this object will be of type
+ * <code>XPathResult</code>.
+ * @return The result of the evaluation of the XPath expression.For XPath
+ * 1.0 results, this object will be of type <code>XPathResult</code>.
+ * @exception XPathException
+ * TYPE_ERR: Raised if the result cannot be converted to return the
+ * specified type.
+ * @exception DOMException
+ * WRONG_DOCUMENT_ERR: The Node is from a document that is not supported
+ * by the XPathEvaluator that created this <code>XPathExpression</code>
+ * .
+ * <br>NOT_SUPPORTED_ERR: The Node is not a type permitted as an XPath
+ * context node or the request type is not permitted by this
+ * <code>XPathExpression</code>.
+ */
+ public Object evaluate(Node contextNode,
+ short type,
+ Object result)
+ throws XPathException, DOMException;
+
+}
diff --git a/libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathNSResolver.java b/libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathNSResolver.java
new file mode 100644
index 000000000..5ce068de9
--- /dev/null
+++ b/libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathNSResolver.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom.xpath;
+
+/**
+ * The <code>XPathNSResolver</code> interface permit <code>prefix</code>
+ * strings in the expression to be properly bound to
+ * <code>namespaceURI</code> strings. <code>XPathEvaluator</code> can
+ * construct an implementation of <code>XPathNSResolver</code> from a node,
+ * or the interface may be implemented by any application.
+ * <p>See also the <a href='http://www.w3.org/TR/2004/NOTE-DOM-Level-3-XPath-20040226'>Document Object Model (DOM) Level 3 XPath Specification</a>.
+ */
+public interface XPathNSResolver {
+ /**
+ * Look up the namespace URI associated to the given namespace prefix. The
+ * XPath evaluator must never call this with a <code>null</code> or
+ * empty argument, because the result of doing this is undefined.
+ * @param prefix The prefix to look for.
+ * @return Returns the associated namespace URI or <code>null</code> if
+ * none is found.
+ */
+ public String lookupNamespaceURI(String prefix);
+
+}
diff --git a/libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathNamespace.java b/libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathNamespace.java
new file mode 100644
index 000000000..d644051f2
--- /dev/null
+++ b/libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathNamespace.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom.xpath;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * The <code>XPathNamespace</code> interface is returned by
+ * <code>XPathResult</code> interfaces to represent the XPath namespace node
+ * type that DOM lacks. There is no public constructor for this node type.
+ * Attempts to place it into a hierarchy or a NamedNodeMap result in a
+ * <code>DOMException</code> with the code <code>HIERARCHY_REQUEST_ERR</code>
+ * . This node is read only, so methods or setting of attributes that would
+ * mutate the node result in a DOMException with the code
+ * <code>NO_MODIFICATION_ALLOWED_ERR</code>.
+ * <p>The core specification describes attributes of the <code>Node</code>
+ * interface that are different for different node types but does not
+ * describe <code>XPATH_NAMESPACE_NODE</code>, so here is a description of
+ * those attributes for this node type. All attributes of <code>Node</code>
+ * not described in this section have a <code>null</code> or
+ * <code>false</code> value.
+ * <p><code>ownerDocument</code> matches the <code>ownerDocument</code> of the
+ * <code>ownerElement</code> even if the element is later adopted.
+ * <p><code>nodeName</code> is always the string "<code>#namespace</code>".
+ * <p><code>prefix</code> is the prefix of the namespace represented by the
+ * node.
+ * <p><code>localName</code> is the same as <code>prefix</code>.
+ * <p><code>nodeType</code> is equal to <code>XPATH_NAMESPACE_NODE</code>.
+ * <p><code>namespaceURI</code> is the namespace URI of the namespace
+ * represented by the node.
+ * <p><code>nodeValue</code> is the same as <code>namespaceURI</code>.
+ * <p><code>adoptNode</code>, <code>cloneNode</code>, and
+ * <code>importNode</code> fail on this node type by raising a
+ * <code>DOMException</code> with the code <code>NOT_SUPPORTED_ERR</code>.
+ * <p ><b>Note:</b> In future versions of the XPath specification, the
+ * definition of a namespace node may be changed incomatibly, in which case
+ * incompatible changes to field values may be required to implement
+ * versions beyond XPath 1.0.
+ * <p>See also the <a href='http://www.w3.org/TR/2004/NOTE-DOM-Level-3-XPath-20040226'>Document Object Model (DOM) Level 3 XPath Specification</a>.
+ */
+public interface XPathNamespace extends Node {
+ // XPathNodeType
+ /**
+ * The node is a <code>Namespace</code>.
+ */
+ public static final short XPATH_NAMESPACE_NODE = 13;
+
+ /**
+ * The <code>Element</code> on which the namespace was in scope when it
+ * was requested. This does not change on a returned namespace node even
+ * if the document changes such that the namespace goes out of scope on
+ * that element and this node is no longer found there by XPath.
+ */
+ public Element getOwnerElement();
+
+}
diff --git a/libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathResult.java b/libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathResult.java
new file mode 100644
index 000000000..06fd29dac
--- /dev/null
+++ b/libjava/classpath/external/w3c_dom/org/w3c/dom/xpath/XPathResult.java
@@ -0,0 +1,214 @@
+/*
+ * Copyright (c) 2004 World Wide Web Consortium,
+ *
+ * (Massachusetts Institute of Technology, European Research Consortium for
+ * Informatics and Mathematics, Keio University). All Rights Reserved. This
+ * work is distributed under the W3C(r) Software License [1] in the hope that
+ * it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+ */
+
+package org.w3c.dom.xpath;
+
+import org.w3c.dom.Node;
+import org.w3c.dom.DOMException;
+
+/**
+ * The <code>XPathResult</code> interface represents the result of the
+ * evaluation of an XPath 1.0 expression within the context of a particular
+ * node. Since evaluation of an XPath expression can result in various
+ * result types, this object makes it possible to discover and manipulate
+ * the type and value of the result.
+ * <p>See also the <a href='http://www.w3.org/TR/2004/NOTE-DOM-Level-3-XPath-20040226'>Document Object Model (DOM) Level 3 XPath Specification</a>.
+ */
+public interface XPathResult {
+ // XPathResultType
+ /**
+ * This code does not represent a specific type. An evaluation of an XPath
+ * expression will never produce this type. If this type is requested,
+ * then the evaluation returns whatever type naturally results from
+ * evaluation of the expression.
+ * <br>If the natural result is a node set when <code>ANY_TYPE</code> was
+ * requested, then <code>UNORDERED_NODE_ITERATOR_TYPE</code> is always
+ * the resulting type. Any other representation of a node set must be
+ * explicitly requested.
+ */
+ public static final short ANY_TYPE = 0;
+ /**
+ * The result is a <a href='http://www.w3.org/TR/1999/REC-xpath-19991116#numbers'>number</a> as defined by [<a href='http://www.w3.org/TR/1999/REC-xpath-19991116'>XPath 1.0</a>].
+ * Document modification does not invalidate the number, but may mean
+ * that reevaluation would not yield the same number.
+ */
+ public static final short NUMBER_TYPE = 1;
+ /**
+ * The result is a <a href='http://www.w3.org/TR/1999/REC-xpath-19991116#strings'>string</a> as defined by [<a href='http://www.w3.org/TR/1999/REC-xpath-19991116'>XPath 1.0</a>].
+ * Document modification does not invalidate the string, but may mean
+ * that the string no longer corresponds to the current document.
+ */
+ public static final short STRING_TYPE = 2;
+ /**
+ * The result is a <a href='http://www.w3.org/TR/1999/REC-xpath-19991116#booleans'>boolean</a> as defined by [<a href='http://www.w3.org/TR/1999/REC-xpath-19991116'>XPath 1.0</a>].
+ * Document modification does not invalidate the boolean, but may mean
+ * that reevaluation would not yield the same boolean.
+ */
+ public static final short BOOLEAN_TYPE = 3;
+ /**
+ * The result is a <a href='http://www.w3.org/TR/1999/REC-xpath-19991116#node-sets'>node set</a> as defined by [<a href='http://www.w3.org/TR/1999/REC-xpath-19991116'>XPath 1.0</a>] that
+ * will be accessed iteratively, which may not produce nodes in a
+ * particular order. Document modification invalidates the iteration.
+ * <br>This is the default type returned if the result is a node set and
+ * <code>ANY_TYPE</code> is requested.
+ */
+ public static final short UNORDERED_NODE_ITERATOR_TYPE = 4;
+ /**
+ * The result is a node set as defined by [<a href='http://www.w3.org/TR/1999/REC-xpath-19991116'>XPath 1.0</a>] that
+ * will be accessed iteratively, which will produce document-ordered
+ * nodes. Document modification invalidates the iteration.
+ */
+ public static final short ORDERED_NODE_ITERATOR_TYPE = 5;
+ /**
+ * The result is a <a href='http://www.w3.org/TR/1999/REC-xpath-19991116#node-sets'>node set</a> as defined by [<a href='http://www.w3.org/TR/1999/REC-xpath-19991116'>XPath 1.0</a>] that
+ * will be accessed as a snapshot list of nodes that may not be in a
+ * particular order. Document modification does not invalidate the
+ * snapshot but may mean that reevaluation would not yield the same
+ * snapshot and nodes in the snapshot may have been altered, moved, or
+ * removed from the document.
+ */
+ public static final short UNORDERED_NODE_SNAPSHOT_TYPE = 6;
+ /**
+ * The result is a <a href='http://www.w3.org/TR/1999/REC-xpath-19991116#node-sets'>node set</a> as defined by [<a href='http://www.w3.org/TR/1999/REC-xpath-19991116'>XPath 1.0</a>] that
+ * will be accessed as a snapshot list of nodes that will be in original
+ * document order. Document modification does not invalidate the
+ * snapshot but may mean that reevaluation would not yield the same
+ * snapshot and nodes in the snapshot may have been altered, moved, or
+ * removed from the document.
+ */
+ public static final short ORDERED_NODE_SNAPSHOT_TYPE = 7;
+ /**
+ * The result is a <a href='http://www.w3.org/TR/1999/REC-xpath-19991116#node-sets'>node set</a> as defined by [<a href='http://www.w3.org/TR/1999/REC-xpath-19991116'>XPath 1.0</a>] and
+ * will be accessed as a single node, which may be <code>null</code>if
+ * the node set is empty. Document modification does not invalidate the
+ * node, but may mean that the result node no longer corresponds to the
+ * current document. This is a convenience that permits optimization
+ * since the implementation can stop once any node in the resulting set
+ * has been found.
+ * <br>If there is more than one node in the actual result, the single
+ * node returned might not be the first in document order.
+ */
+ public static final short ANY_UNORDERED_NODE_TYPE = 8;
+ /**
+ * The result is a <a href='http://www.w3.org/TR/1999/REC-xpath-19991116#node-sets'>node set</a> as defined by [<a href='http://www.w3.org/TR/1999/REC-xpath-19991116'>XPath 1.0</a>] and
+ * will be accessed as a single node, which may be <code>null</code> if
+ * the node set is empty. Document modification does not invalidate the
+ * node, but may mean that the result node no longer corresponds to the
+ * current document. This is a convenience that permits optimization
+ * since the implementation can stop once the first node in document
+ * order of the resulting set has been found.
+ * <br>If there are more than one node in the actual result, the single
+ * node returned will be the first in document order.
+ */
+ public static final short FIRST_ORDERED_NODE_TYPE = 9;
+
+ /**
+ * A code representing the type of this result, as defined by the type
+ * constants.
+ */
+ public short getResultType();
+
+ /**
+ * The value of this number result. If the native double type of the DOM
+ * binding does not directly support the exact IEEE 754 result of the
+ * XPath expression, then it is up to the definition of the binding to
+ * specify how the XPath number is converted to the native binding
+ * number.
+ * @exception XPathException
+ * TYPE_ERR: raised if <code>resultType</code> is not
+ * <code>NUMBER_TYPE</code>.
+ */
+ public double getNumberValue()
+ throws XPathException;
+
+ /**
+ * The value of this string result.
+ * @exception XPathException
+ * TYPE_ERR: raised if <code>resultType</code> is not
+ * <code>STRING_TYPE</code>.
+ */
+ public String getStringValue()
+ throws XPathException;
+
+ /**
+ * The value of this boolean result.
+ * @exception XPathException
+ * TYPE_ERR: raised if <code>resultType</code> is not
+ * <code>BOOLEAN_TYPE</code>.
+ */
+ public boolean getBooleanValue()
+ throws XPathException;
+
+ /**
+ * The value of this single node result, which may be <code>null</code>.
+ * @exception XPathException
+ * TYPE_ERR: raised if <code>resultType</code> is not
+ * <code>ANY_UNORDERED_NODE_TYPE</code> or
+ * <code>FIRST_ORDERED_NODE_TYPE</code>.
+ */
+ public Node getSingleNodeValue()
+ throws XPathException;
+
+ /**
+ * Signifies that the iterator has become invalid. True if
+ * <code>resultType</code> is <code>UNORDERED_NODE_ITERATOR_TYPE</code>
+ * or <code>ORDERED_NODE_ITERATOR_TYPE</code> and the document has been
+ * modified since this result was returned.
+ */
+ public boolean getInvalidIteratorState();
+
+ /**
+ * The number of nodes in the result snapshot. Valid values for
+ * snapshotItem indices are <code>0</code> to
+ * <code>snapshotLength-1</code> inclusive.
+ * @exception XPathException
+ * TYPE_ERR: raised if <code>resultType</code> is not
+ * <code>UNORDERED_NODE_SNAPSHOT_TYPE</code> or
+ * <code>ORDERED_NODE_SNAPSHOT_TYPE</code>.
+ */
+ public int getSnapshotLength()
+ throws XPathException;
+
+ /**
+ * Iterates and returns the next node from the node set or
+ * <code>null</code>if there are no more nodes.
+ * @return Returns the next node.
+ * @exception XPathException
+ * TYPE_ERR: raised if <code>resultType</code> is not
+ * <code>UNORDERED_NODE_ITERATOR_TYPE</code> or
+ * <code>ORDERED_NODE_ITERATOR_TYPE</code>.
+ * @exception DOMException
+ * INVALID_STATE_ERR: The document has been mutated since the result was
+ * returned.
+ */
+ public Node iterateNext()
+ throws XPathException, DOMException;
+
+ /**
+ * Returns the <code>index</code>th item in the snapshot collection. If
+ * <code>index</code> is greater than or equal to the number of nodes in
+ * the list, this method returns <code>null</code>. Unlike the iterator
+ * result, the snapshot does not become invalid, but may not correspond
+ * to the current document if it is mutated.
+ * @param index Index into the snapshot collection.
+ * @return The node at the <code>index</code>th position in the
+ * <code>NodeList</code>, or <code>null</code> if that is not a valid
+ * index.
+ * @exception XPathException
+ * TYPE_ERR: raised if <code>resultType</code> is not
+ * <code>UNORDERED_NODE_SNAPSHOT_TYPE</code> or
+ * <code>ORDERED_NODE_SNAPSHOT_TYPE</code>.
+ */
+ public Node snapshotItem(int index)
+ throws XPathException;
+
+}