org.inria.ns.reflex.xml.xpath.xpointer
Class XPointerScheme

java.lang.Object
  extended by org.inria.ns.reflex.xml.CompiledExpression.Impl
      extended by org.inria.ns.reflex.xml.xpath.xpointer.XPointerScheme
All Implemented Interfaces:
CompiledExpression, SchemeBased, XPointer

public class XPointerScheme
extends CompiledExpression.Impl
implements XPointer, SchemeBased

The implementation of the XPointer xpointer() scheme.

This scheme simply select a result thanks to an XPath expression.

Author:
Philippe Poulard

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.inria.ns.reflex.xml.CompiledExpression
CompiledExpression.Impl
 
Constructor Summary
XPointerScheme(String expression, XFactory factory)
          Create a new xpointer() XPointer expression.
 
Method Summary
 Pattern asPattern()
          Return the underlying XPath pattern.
 Object evaluate(XPathContext context)
          Select a result with XPath.
 QName getSchemeName()
          Return the name of this scheme.
 
Methods inherited from class org.inria.ns.reflex.xml.CompiledExpression.Impl
getXFactory
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.inria.ns.reflex.xml.CompiledExpression
getXFactory
 

Constructor Detail

XPointerScheme

public XPointerScheme(String expression,
                      XFactory factory)
               throws XPointerSyntaxException
Create a new xpointer() XPointer expression.

Parameters:
expression - The XPointer expression.
factory - The factory.
Throws:
XPathSyntaxException
XPointerSyntaxException
Method Detail

getSchemeName

public QName getSchemeName()
Return the name of this scheme.

Specified by:
getSchemeName in interface SchemeBased
Returns:
"xpointer".
See Also:
XMLNames.XPOINTER_XPOINTER_SCHEME, SchemeBased.getSchemeName()

evaluate

public Object evaluate(XPathContext context)
                throws XPathException
Select a result with XPath.

Specified by:
evaluate in interface CompiledExpression
Parameters:
context - The context.
Returns:
The result selected.
Throws:
XPathException
See Also:
CompiledExpression.evaluate(org.inria.ns.reflex.xml.xpath.XPathContext)

asPattern

public Pattern asPattern()
                  throws BadPatternException
Return the underlying XPath pattern.

Specified by:
asPattern in interface CompiledExpression
Returns:
This expression as a pattern.
Throws:
BadPatternException - If this expression can't be converted to a pattern.
See Also:
CompiledExpression.asPattern()