Interface XPath


public interface XPath
Abstraction for holding and evaluating XPaths into XML documents.

XPaths can be evaluated multiple times, but implementations are free to synchronized access so that only one thread at a time may be evaluating the path.

Instances should be created by an XPathFactory (i.e. abstract factory pattern).

Supported API: true

Extendable: false

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    evaluate(Node node_to_operate_on)
    Evaluates the xpath relative to the specified node and returns the result as the most appropriate object.
  • Method Details

    • evaluate

      Object evaluate(Node node_to_operate_on) throws XPathException
      Evaluates the xpath relative to the specified node and returns the result as the most appropriate object. This will be a Double, String, Boolean, NodeList, DocumentFragment, null, or, where none of these are appropriate, an implementation specific object.

      One should not use this method as an excuse to implement poor code consisting of switches or cascading if-else-ifs where the type of the result is checked via the instanceof operator. This method should only be used when a single result type is demanded.

      Supported API: true

      Parameters:
      node_to_operate_on -
      Returns:
      Object
      Throws:
      XPathException