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

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

public class XmlnsScheme
extends CompiledExpression.Impl
implements XPointer, SchemeBased

The implementation of the XPointer xmlns() scheme.

Author:
Philippe Poulard

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.inria.ns.reflex.xml.CompiledExpression
CompiledExpression.Impl
 
Constructor Summary
XmlnsScheme(String schemeData, XFactory factory)
          Create a new xmlns binding.
 
Method Summary
 Pattern asPattern()
          Return this xmlns binding as a pattern
 Object evaluate(XPathContext context)
          Change the namespace context.
 String getNamespaceURI()
          Return the namespace URI defined by this xmlns binding.
 String getPrefix()
          Return the prefix defined by this xmlns binding.
 QName getSchemeName()
          Return the name of this scheme.
 NamespaceContext mergeWith(NamespaceContext namespaceContext)
          Merge this xmlns binding with the given namespace context.
 
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

XmlnsScheme

public XmlnsScheme(String schemeData,
                   XFactory factory)
Create a new xmlns binding.

Parameters:
schemeData - "prefix=namespaceURI"
factory - The factory that has created this binding.
Method Detail

getSchemeName

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

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

evaluate

public Object evaluate(XPathContext context)
                throws XPathException
Change the namespace context.

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

getNamespaceURI

public String getNamespaceURI()
Return the namespace URI defined by this xmlns binding.

Returns:
The namespace URI defined by this xmlns binding.

getPrefix

public String getPrefix()
Return the prefix defined by this xmlns binding.

Returns:
The prefix defined by this xmlns binding.

mergeWith

public NamespaceContext mergeWith(NamespaceContext namespaceContext)
Merge this xmlns binding with the given namespace context.

Parameters:
namespaceContext - The namespace context to merge with.
Returns:
A new namespace context that can resolve the prefix defined in this xmlns binding and the prefixes defined in the given namespace context.

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()