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

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

public class ShorthandXPointer
extends CompiledExpression.Impl
implements XPointer

A ShorthandXPointer select an element by its ID.

Author:
Philippe Poulard

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.inria.ns.reflex.xml.CompiledExpression
CompiledExpression.Impl
 
Constructor Summary
ShorthandXPointer(String id, XFactory factory)
          Create a new XPointer expression.
 
Method Summary
 Pattern asPattern()
          Return this xmlns binding as a pattern.
 Object evaluate(XPathContext context)
          Return the element identified by the ID given in this shorthand XPointer expression.
 
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

ShorthandXPointer

public ShorthandXPointer(String id,
                         XFactory factory)
Create a new XPointer expression.

Parameters:
id - The ID.
factory - The factory that has created this binding.
Throws:
XPointerSyntaxException - When the scheme datas can't be parsed.
Method Detail

evaluate

public Object evaluate(XPathContext context)
                throws XPathException
Return the element identified by the ID given in this shorthand XPointer expression.

Specified by:
evaluate in interface CompiledExpression
Parameters:
context - The context.
Returns:
The element that has the expected ID.
Throws:
XPathException
See Also:
CompiledExpression.evaluate(org.inria.ns.reflex.xml.xpath.XPathContext)

asPattern

public Pattern asPattern()
                  throws BadPatternException
Return this xmlns binding as a 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()