This appendix contains the complete Java [Java] bindings for the Level 3 Document Object Model XPath.
The Java files are also available as http://www.w3.org/TR/2001/WD-DOM-Level-3-XPath-20011031/java-binding.zip
package org.w3c.dom.xpath; public class XPathException extends RuntimeException { public XPathException(short code, String message) { super(message); this.code = code; } public short code; // XPathExceptionCode public static final short INVALID_EXPRESSION_ERR = 1; public static final short TYPE_ERR = 2; }
package org.w3c.dom.xpath; import org.w3c.dom.Node; import org.w3c.dom.DOMException; public interface XPathEvaluator { public XPathExpression createExpression(String expression, XPathNSResolver resolver) throws XPathException, DOMException; public XPathResult createResult(); public XPathNSResolver createNSResolver(Node nodeResolver); public XPathResult evaluate(String expression, Node contextNode, XPathNSResolver resolver, short type, XPathResult result) throws XPathException, DOMException; }
package org.w3c.dom.xpath; import org.w3c.dom.Node; import org.w3c.dom.DOMException; public interface XPathExpression { public XPathResult evaluate(Node contextNode, short type, XPathResult result) throws XPathException, DOMException; }
package org.w3c.dom.xpath; public interface XPathNSResolver { public String lookupNamespaceURI(String prefix); }
package org.w3c.dom.xpath; import org.w3c.dom.Node; import org.w3c.dom.DOMException; public interface XPathResult { // XPathResultType public static final short ANY_TYPE = 0; public static final short NUMBER_TYPE = 1; public static final short STRING_TYPE = 2; public static final short BOOLEAN_TYPE = 3; public static final short NODE_SET_TYPE = 4; public static final short SINGLE_NODE_TYPE = 5; public short getResultType(); public double getNumberValue() throws XPathException; public String getStringValue() throws XPathException; public boolean getBooleanValue() throws XPathException; public Node getSingleNodeValue() throws XPathException; public XPathSetIterator getSetIterator(boolean ordered) throws XPathException, DOMException; public XPathSetSnapshot getSetSnapshot(boolean ordered) throws XPathException, DOMException; }
package org.w3c.dom.xpath; import org.w3c.dom.Node; import org.w3c.dom.DOMException; public interface XPathSetIterator { public Node nextNode() throws DOMException; }
package org.w3c.dom.xpath; import org.w3c.dom.Node; public interface XPathSetSnapshot { public Node item(int index); public int getLength(); }
package org.w3c.dom.xpath; import org.w3c.dom.Element; import org.w3c.dom.Node; public interface XPathNamespace extends Node { // XPathNodeType public static final short XPATH_NAMESPACE_NODE = 13; public Element getOwnerElement(); }