org.inria.ns.reflex.xml
Interface CompiledExpression

All Known Subinterfaces:
SchemeBased, XPath, XPointer
All Known Implementing Classes:
CompiledExpression.Impl, ComposedXPointer, ElementScheme, JaxenXPath, ShorthandXPointer, XmlnsScheme, XPointerScheme

public interface CompiledExpression

Defines a compiled XPath/XPointer expression ready to use.

Author:
Philippe Poulard

Nested Class Summary
static class CompiledExpression.Impl
          A partial implementation of a compiled expression.
 
Method Summary
 Pattern asPattern()
          An expression can be converted to a pattern.
 Object evaluate(XPathContext context)
          Evaluate this expression against a given context.
 XFactory getXFactory()
          Return the factory that built this compiled expression.
 

Method Detail

getXFactory

XFactory getXFactory()
Return the factory that built this compiled expression.

Returns:
The factory that built this compiled expression.

evaluate

Object evaluate(XPathContext context)
                throws XPathException
Evaluate this expression against a given context.

If the expression evaluates to a single primitive (String, Number or Boolean) type, it is returned directly. Otherwise, the returned value is a List (anode-set, in the terms of the specification) of values.

When using this method, one must be careful to test the class of the returned objects, and of each of the composite members if a List is returned. If the returned members are XML entities, they will be the actual Document, Element or Attribute objects as defined by the concrete XML object-model implementation, directly from the context document. This does not return copies of anything , but merely returns references to entities within the source document.

Parameters:
context - is the Context which gets evaluated.
Returns:
The result of evaluating this expression against the supplied context.
Throws:
XPathException

asPattern

Pattern asPattern()
                  throws BadPatternException
An expression can be converted to a pattern.

Returns:
This expression as a pattern.
Throws:
BadPatternException - If this expression can't be converted to a pattern.