com.novell.xml.xpath
Class Basis

java.lang.Object
  extended bycom.novell.xml.xpath.Basis
All Implemented Interfaces:
ContextNodeList

public class Basis
extends Object
implements ContextNodeList

This class represents a Basis in the XPath expression language NOTE: it implements NamespaceContext for the benefit of NodeTest.evaluate()

See Also:
Step

Field Summary
 
Fields inherited from interface com.novell.xml.xpath.ContextNodeList
DOCUMENT_ORDER, REVERSE_DOCUMENT_ORDER, UNKNOWN_ORDER
 
Constructor Summary
Basis(AxisNameToken axisName, NodeTest nodeTest)
          Construct a Basis object based on an AxisName and a NodeTest
Basis(AxisNameToken axisName, NodeTypeToken nodeType)
          Construct a Basis object based on an AxisName and a NodeType
Basis(AxisNameToken axisName, NodeTypeToken nodeType, String literal)
          Construct a Basis object based on an AxisName and a pi() NodeType
Basis(AxisNameToken axisName, WildcardNameToken wildcardName, NamespaceContext nsContext)
          Construct a Basis object based on an AxisName and a WildcardName
Basis(Axis axis, NodeTest nodeTest)
          Construct a Basis object based on an AxisName and a NodeTest
 
Method Summary
 int count()
          Return count of nodes in Basis
protected  void createAxis(AxisNameToken axisName)
          Create the appropriate axis object based on the passed token
 void done()
          stop referencing resources that are no longer needed
 Node first()
          Return first node in Basis based on passed context node and expression context
 ExpandedQName getExpandedName(String qName)
          Return the expanded name given the passed QName, given the current namespace context
 ContextListMark getMark()
          Return a marker to a position in a ContextNodeList.
 NamespaceName getNamespaceName(String prefix)
          Return the currently in-scope namespace URI for the passed prefix.
protected  Node incPosition(Node node)
          Increment the current node position (the result returned from position())
protected  void init()
          Initialize state for first()
 Node next()
          Return next node in Basis following a call to first() or next()
 int order()
          Return order in which nodes are returned from first()-next()
 int position()
          Return the position of the last node returned by a call to first() or next()
 Node returnToMark(ContextListMark mark)
          Go to a position in a ContextNodeList previously marked with getMark()
 void setup(Node contextNode, ExpressionContext context)
          Initialize this basis with a context node for the axis to operate on.
 String toString()
          Provide a readable description of the for debugging.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Basis

public Basis(Axis axis,
             NodeTest nodeTest)
Construct a Basis object based on an AxisName and a NodeTest

Parameters:
axis - axis object
nodeTest - node test object

Basis

public Basis(AxisNameToken axisName,
             NodeTest nodeTest)
Construct a Basis object based on an AxisName and a NodeTest

Parameters:
axisName - axis name token
nodeTest - node test object

Basis

public Basis(AxisNameToken axisName,
             NodeTypeToken nodeType)
Construct a Basis object based on an AxisName and a NodeType

Parameters:
axisName - axis name token
nodeType - node type token

Basis

public Basis(AxisNameToken axisName,
             NodeTypeToken nodeType,
             String literal)
      throws XPathException,
             Exception
Construct a Basis object based on an AxisName and a pi() NodeType

Parameters:
axisName - axis name token
nodeType - node type token (MUST be pi)
literal - string literal argument for pi()

Basis

public Basis(AxisNameToken axisName,
             WildcardNameToken wildcardName,
             NamespaceContext nsContext)
      throws XPathException
Construct a Basis object based on an AxisName and a WildcardName

Parameters:
axisName - axis name token
wildcardName - wildcard name token
nsContext - The namespace context to use to resolve any WildcardName prefix
Method Detail

toString

public String toString()
Provide a readable description of the for debugging.

Returns:
String representation

setup

public void setup(Node contextNode,
                  ExpressionContext context)
Initialize this basis with a context node for the axis to operate on.

Parameters:
contextNode - the context node

done

public void done()
stop referencing resources that are no longer needed


first

public Node first()
           throws XPathEvaluationException
Return first node in Basis based on passed context node and expression context

Specified by:
first in interface ContextNodeList
Returns:
first node in Basis
Throws:
XPathEvaluationException

next

public Node next()
          throws XPathEvaluationException
Return next node in Basis following a call to first() or next()

Specified by:
next in interface ContextNodeList
Returns:
next node in Basis
Throws:
XPathEvaluationException

count

public int count()
          throws XPathEvaluationException
Return count of nodes in Basis

Specified by:
count in interface ContextNodeList
Returns:
count of nodes in Basis
Throws:
XPathEvaluationException

position

public int position()
Return the position of the last node returned by a call to first() or next()

Specified by:
position in interface ContextNodeList
Returns:
Node position in node list. 0 is returned if no nodes have been returned. Once first() or next() return null (indicating no more nodes in list) the return will be the position of the last node in the list.

order

public int order()
Return order in which nodes are returned from first()-next()

Specified by:
order in interface ContextNodeList
Returns:
DOCUMENT_ORDER or REVERSE_DOCUMENT_ORDER

getMark

public ContextListMark getMark()
Return a marker to a position in a ContextNodeList. This marker can be used later in a call to returnToMark() to return to a particular position in the list.

Specified by:
getMark in interface ContextNodeList
Returns:
an opaque marker

returnToMark

public Node returnToMark(ContextListMark mark)
Go to a position in a ContextNodeList previously marked with getMark()

Specified by:
returnToMark in interface ContextNodeList
Parameters:
mark - mark returned from getMark()
Returns:
The node at the mark

getNamespaceName

public NamespaceName getNamespaceName(String prefix)
Return the currently in-scope namespace URI for the passed prefix.

Parameters:
prefix - The QName prefix of interest
Returns:
The namespace name associated with the prefix for the passed prefix

getExpandedName

public ExpandedQName getExpandedName(String qName)
Return the expanded name given the passed QName, given the current namespace context

Parameters:
qName - The QName to expand
Returns:
The expanded Name

createAxis

protected void createAxis(AxisNameToken axisName)
Create the appropriate axis object based on the passed token

Parameters:
axisName - AxisNameToken that specifies the axis

init

protected void init()
Initialize state for first()


incPosition

protected Node incPosition(Node node)
Increment the current node position (the result returned from position())

Parameters:
node - The node value (may be null)
Returns:
The passed node