net.sf.saxon.expr
Class AttributeReference

java.lang.Object
  |
  +--net.sf.saxon.expr.ComputedExpression
        |
        +--net.sf.saxon.expr.SingleNodeExpression
              |
              +--net.sf.saxon.expr.AttributeReference
All Implemented Interfaces:
Expression, java.io.Serializable

public class AttributeReference
extends SingleNodeExpression

An expression that represents a reference to a named attribute

See Also:
Serialized Form

Field Summary
 
Fields inherited from class net.sf.saxon.expr.ComputedExpression
lineNumber, NO_ARGUMENTS, staticProperties
 
Constructor Summary
AttributeReference(int fingerprint)
          Constructor
 
Method Summary
 int computeSpecialProperties()
          getProperties(): return properties of this expression, for optimization
 void display(int level, NamePool pool)
          Diagnostic print of expression structure
 boolean effectiveBooleanValue(XPathContext context)
          Evaluate as a boolean.
 boolean equals(java.lang.Object other)
          Is this expression the same as another expression?
 java.lang.String evaluateAsString(XPathContext context)
          Evaluate as a string.
 ItemType getItemType()
          Determine the data type of the items returned by this expression
 NameTest getNameTest()
          Get the attribute name test
 NodeInfo getNode(XPathContext context)
          Return the relevant attribute node
 int hashCode()
          get HashCode for comparing two expressions
 
Methods inherited from class net.sf.saxon.expr.SingleNodeExpression
analyze, computeCardinality, evaluateItem, getIntrinsicDependencies, iterate
 
Methods inherited from class net.sf.saxon.expr.ComputedExpression
computeDependencies, computeStaticProperties, dynamicError, getCardinality, getDependencies, getLineNumber, getSpecialProperties, getSubExpressions, markTailFunctionCalls, promote, setLineNumber, simplify, typeError
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AttributeReference

public AttributeReference(int fingerprint)
Constructor

Method Detail

getItemType

public ItemType getItemType()
Determine the data type of the items returned by this expression

Specified by:
getItemType in interface Expression
Overrides:
getItemType in class SingleNodeExpression
Returns:
the type attribute()

getNameTest

public NameTest getNameTest()
Get the attribute name test


computeSpecialProperties

public int computeSpecialProperties()
getProperties(): return properties of this expression, for optimization

Overrides:
computeSpecialProperties in class ComputedExpression

equals

public boolean equals(java.lang.Object other)
Is this expression the same as another expression?

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
get HashCode for comparing two expressions

Overrides:
hashCode in class java.lang.Object

getNode

public NodeInfo getNode(XPathContext context)
                 throws XPathException
Return the relevant attribute node

Specified by:
getNode in class SingleNodeExpression
Parameters:
context - the evaluation context
XPathException

effectiveBooleanValue

public boolean effectiveBooleanValue(XPathContext context)
                              throws XPathException
Evaluate as a boolean. Returns true if there are any nodes selected by the Expression

Specified by:
effectiveBooleanValue in interface Expression
Overrides:
effectiveBooleanValue in class SingleNodeExpression
Parameters:
context - The context in which the expression is to be evaluated
Returns:
true if there are any nodes selected by the Expression
Throws:
XPathException - if any dynamic error occurs evaluating the expression

evaluateAsString

public java.lang.String evaluateAsString(XPathContext context)
                                  throws XPathException
Evaluate as a string. Returns the string value of the attribute if it exists

Specified by:
evaluateAsString in interface Expression
Overrides:
evaluateAsString in class ComputedExpression
Parameters:
context - The context in which the expression is to be evaluated
Returns:
the string value of the attribute if present, or "" otherwise
Throws:
XPathException - if any dynamic error occurs evaluating the expression

display

public void display(int level,
                    NamePool pool)
Diagnostic print of expression structure

Parameters:
level - indentation level for this expression