com.saxonica.expr

## Class PathFinder

- java.lang.Object
- - com.saxonica.expr.PathFinder

- All Implemented Interfaces:
    Serializable, PatternFinder

      public class PathFinder
      extends Object
      implements PatternFinder

  This class enables a client to find all nodes in a document that match a particular pattern. In fact, it allows any subset of nodes in a document to be located. It is used specifically by the internal implementation of keys. In XSLT, the criterion for including nodes in a key is that they match an XSLT pattern. Internally, however, keys are used for a wider range of purposes, and the nodes indexed by the key are defined by a PatternFinder
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PathFinder(Expression path)` Create a PathFinder that finds all the nodes returned by a particular expression when invoked with the document node as context node

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Expression` | `getSelectionExpression()` Get the underlying expression (usually a path expression or filter expression)
    `SequenceIterator` | `selectNodes(DocumentInfo doc, XPathContext context)` Select nodes in a document using this PatternFinder.
    `String` | `toString()` Get a string representation of the expression.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### PathFinder

          public PathFinder(Expression path)

      Create a PathFinder that finds all the nodes returned by a particular expression when invoked with the document node as context node
      Parameters:
        `path` - an expression designed to be evaluated with the document node of a tree as the context node, and which selects a set of nodes within the tree

  - ### Method Detail

    - #### selectNodes

          public SequenceIterator selectNodes(DocumentInfo doc,
                                     XPathContext context)
                                       throws XPathException

      Select nodes in a document using this PatternFinder.
      Specified by:
        `selectNodes` in interface `PatternFinder`
      Parameters:
        `doc` - the document node at the root of a tree
        `context` - the dynamic evaluation context
      Returns:
        an iterator over the selected nodes in the document.
      Throws:
        `XPathException` - if a dynamic error is encountered

    - #### getSelectionExpression

          public Expression getSelectionExpression()

      Get the underlying expression (usually a path expression or filter expression)
      Returns:
        the underlying expression

    - #### toString

          public String toString()

      Get a string representation of the expression. Used in "explain" output
      Overrides:
        `toString` in class `Object`

Copyright (c) 2004-2013 Saxonica Limited. All rights reserved.