18 June 2001

Appendix B: Java Language Binding

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-20010618/java-binding.zip

B.1: Other XPath interfaces

org/w3c/dom/xpath/XPathException.java:

package org.w3c.dom.xpath;

public class XPathException extends RuntimeException {
    public XPathException(short code, String message) {
       super(message);
       this.code = code;
    }
    public short   code;
};

org/w3c/dom/xpath/XPathEvaluator.java:

package org.w3c.dom.xpath;

import org.w3c.dom.Node;

public interface XPathEvaluator {
    public boolean evaluateAsBoolean(String expression, 
                                     Node contextNode, 
                                     NamespaceResolver resolver)
                                     throws XPathException;

    public double evaluateAsNumber(String expression, 
                                   Node contextNode, 
                                   NamespaceResolver resolver)
                                   throws XPathException;

    public String evaluateAsString(String expression, 
                                   Node contextNode, 
                                   NamespaceResolver resolver)
                                   throws XPathException;

    public Node evaluateAsNode(String expression, 
                               Node contextNode, 
                               NamespaceResolver resolver)
                               throws XPathException;

    public ActiveNodeSet evaluateAsNodeSet(String expression, 
                                           Node contextNode, 
                                           NamespaceResolver resolver)
                                           throws XPathException;

}

org/w3c/dom/xpath/StaticNodeSet.java:

package org.w3c.dom.xpath;

import org.w3c.dom.Node;

public interface StaticNodeSet {
    public Node item(int index);

    public int getLength();

}

org/w3c/dom/xpath/ActiveNodeSet.java:

package org.w3c.dom.xpath;

import org.w3c.dom.Node;
import org.w3c.dom.DOMException;

public interface ActiveNodeSet {
    public Node nextNode()
                         throws DOMException;

    public void reset()
                      throws DOMException;

    public ActiveNodeSet cloneSet()
                                  throws DOMException;

    public ActiveNodeSet getDocumentOrderedSet()
                                               throws DOMException;

    public StaticNodeSet getStaticNodeSet()
                                          throws DOMException;

}

org/w3c/dom/xpath/NamespaceResolver.java:

package org.w3c.dom.xpath;

public interface NamespaceResolver {
    public String lookupNamespaceURI(String prefix);

}