org.jaxen.expr
Class DefaultNameStep

java.lang.Object
  extended byorg.jaxen.expr.DefaultStep
      extended byorg.jaxen.expr.DefaultNameStep
All Implemented Interfaces:
NameStep, Predicated, java.io.Serializable, Step, Visitable

public class DefaultNameStep
extends DefaultStep
implements NameStep

Expression object that represents any flavor of name-test steps within an XPath.

This includes simple steps, such as "foo", non-default-axis steps, such as "following-sibling::foo" or "@foo", and namespace-aware steps, such as "foo:bar".

Author:
bob mcwhirter (bob@werken.com)
See Also:
Serialized Form

Field Summary
(package private)  boolean hasPrefix
          Quick flag denoting if we have a namespace prefix
private  java.lang.String localName
          Our local-name.
private  boolean matchesAnyName
          Quick flag denoting if the localname was '*'
private  java.lang.String prefix
          Our prefix, bound through the current Context.
 
Fields inherited from class org.jaxen.expr.DefaultStep
 
Constructor Summary
DefaultNameStep(IterableAxis axis, java.lang.String prefix, java.lang.String localName, PredicateSet predicateSet)
           
 
Method Summary
 void accept(Visitor visitor)
           
 java.lang.String getLocalName()
           
 java.lang.String getPrefix()
           
 java.lang.String getText()
           
private  boolean hasNamespace(java.lang.String uri)
           
 boolean isMatchesAnyName()
           
 boolean matches(java.lang.Object node, ContextSupport contextSupport)
          Performs the node-test part of evaluating the step for the given node (which must be on the axis).
protected  boolean matchesNamespaceURIs(java.lang.String u1, java.lang.String u2)
           
 java.lang.String toString()
           
 
Methods inherited from class org.jaxen.expr.DefaultStep
addPredicate, axisIterator, evaluate, getAxis, getAxisName, getIterableAxis, getPredicates, getPredicateSet, simplify
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jaxen.expr.Step
axisIterator, evaluate, getAxis, simplify
 
Methods inherited from interface org.jaxen.expr.Predicated
addPredicate, getPredicates, getPredicateSet
 

Field Detail

prefix

private java.lang.String prefix
Our prefix, bound through the current Context. The empty-string ("") if no prefix was specified. Decidedly NOT-NULL, due to SAXPath constraints.


localName

private java.lang.String localName
Our local-name.


matchesAnyName

private boolean matchesAnyName
Quick flag denoting if the localname was '*'


hasPrefix

boolean hasPrefix
Quick flag denoting if we have a namespace prefix

Constructor Detail

DefaultNameStep

public DefaultNameStep(IterableAxis axis,
                       java.lang.String prefix,
                       java.lang.String localName,
                       PredicateSet predicateSet)
Method Detail

getPrefix

public java.lang.String getPrefix()
Specified by:
getPrefix in interface NameStep

getLocalName

public java.lang.String getLocalName()
Specified by:
getLocalName in interface NameStep

isMatchesAnyName

public boolean isMatchesAnyName()

getText

public java.lang.String getText()
Specified by:
getText in interface Step
Overrides:
getText in class DefaultStep

toString

public java.lang.String toString()
Overrides:
toString in class DefaultStep

matches

public boolean matches(java.lang.Object node,
                       ContextSupport contextSupport)
Description copied from interface: Step
Performs the node-test part of evaluating the step for the given node (which must be on the axis).

Specified by:
matches in interface Step

hasNamespace

private boolean hasNamespace(java.lang.String uri)

matchesNamespaceURIs

protected boolean matchesNamespaceURIs(java.lang.String u1,
                                       java.lang.String u2)
Returns:
true if the two namespace URIs are equal Note that we may wish to consider null being equal to ""

accept

public void accept(Visitor visitor)
Specified by:
accept in interface Visitable