DOMXPathExpression Class Reference

Inheritance diagram for DOMXPathExpression:

DOMXPathAbsoluteExpression DOMXPathRelativeExpression DOMXPathUnionExpression List of all members.

Detailed Description

This class represents a compiled XPath expression.

This is an abstract class, and you should not try to instantiate it yourself. The factory methods in the XPath class is the prefered way of creating XPath expression objects.

It can be expensive to create objects of this class, so if you code uses the same expression more than once, you should try to reuse the same object as much as possible.


Public Member Functions

(NSArray *)  matchesForContextNode:
(NSString *)  expressionString

Member Function Documentation

- (NSString *) expressionString  
 

Returns an XPath expression string which is equivalent to the compiled object. May not be the same as the one you created the object with, it's most likely a lot more verbose.

For example, this code:

 NSLog( [[DOMXPath expressionWithString:@"hello//@id"] expressionString] );

Would print "child::hello/descendant-or-self::node()/attribute::id", which is a more verbose form of the same expression.

- (NSArray *) matchesForContextNode: (id< DOMNode >)  node  
 

Returns an array containing all nodes matching the expression. If no nodes matches the expression, returns an empty array.

Parameters:
node The node for which to start the evaluation
Exceptions:
DOMXPathEvaluationException Raised if the expression could not be evaluated for some reason. Examples can be predicate indices beyond bounds.