Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
org.apache.xpath.Expression
org.apache.xpath.patterns.NodeTest
public class NodeTest
extends Expression
Nested Class Summary |
Field Summary | |
static XNumber |
|
static XNumber |
|
static XNumber |
|
static XNumber |
|
static XNumber |
|
static int |
|
static String |
|
static String |
|
Constructor Summary | |
| |
| |
|
Method Summary | |
void |
|
static void |
|
boolean |
|
XObject |
|
XObject |
|
XObject |
|
void |
|
double |
|
String |
|
String |
|
static int |
|
XNumber |
|
int |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
Methods inherited from class org.apache.xpath.Expression | |
asIterator , asIteratorRaw , asNode , assertion , bool , canTraverseOutsideSubtree , deepEquals , error , execute , execute , execute , execute , executeCharsToContentHandler , exprAddChild , exprGetChild , exprGetNumChildren , exprGetParent , exprSetParent , fixupVariables , getColumnNumber , getExpressionOwner , getLineNumber , getPublicId , getSystemId , isNodesetExpr , isStableNumber , num , warn , xstr |
public static final XNumber SCORE_NODETEST
The match score if the pattern consists of just a NodeTest.
public static final XNumber SCORE_NSWILD
The match score if the pattern pattern has the form NCName:*.
public static final XNumber SCORE_OTHER
The match score if the pattern consists of something other than just a NodeTest or just a qname.
public static final XNumber SCORE_QNAME
The match score if the pattern has the form of a QName optionally preceded by an @ character.
public static final int SHOW_BYFUNCTION
Special bitmap for match patterns starting with a function. Make sure this does not conflict withNodeFilter
.
- Field Value:
- 65536
public static final String SUPPORTS_PRE_STRIPPING
The URL to pass to the Node#supports method, to see if the DOM has already been stripped of whitespace nodes.
public static final String WILD
The namespace or local name for node tests with a wildcard.
- See Also:
the XPath NameTest production.
public NodeTest()
Null argument constructor.
public NodeTest(int whatToShow)
Construct an NodeTest that doesn't test for node names.
- Parameters:
whatToShow
- Bit set defined mainly byNodeFilter
.
public NodeTest(int whatToShow, String namespace, String name)
Construct an NodeTest that tests for namespaces and node names.
- Parameters:
whatToShow
- Bit set defined mainly byNodeFilter
.namespace
- The namespace to be tested.name
- The local name to be tested.
public void callVisitors(ExpressionOwner owner, XPathVisitor visitor)
- Specified by:
- callVisitors in interface XPathVisitable
- See Also:
XPathVisitable.callVisitors(ExpressionOwner, XPathVisitor)
public static void debugWhatToShow(int whatToShow)
Do a diagnostics dump of a whatToShow bit set.DTMFilter
.
- Parameters:
whatToShow
- Bit set defined mainly by
public boolean deepEquals(Expression expr)
- Overrides:
- deepEquals in interface Expression
- See Also:
Expression.deepEquals(Expression)
public XObject execute(XPathContext xctxt) throws TransformerException
Test the current node to see if it matches the given node test.SCORE_NONE
,SCORE_NSWILD
,SCORE_QNAME
, orSCORE_OTHER
.
- Overrides:
- execute in interface Expression
- Parameters:
xctxt
- XPath runtime context.
- Returns:
SCORE_NODETEST
,
- Throws:
TransformerException
-
public XObject execute(XPathContext xctxt, int context) throws TransformerException
Tell what the test score is for the given node.SCORE_NONE
,SCORE_NSWILD
,SCORE_QNAME
, orSCORE_OTHER
.
- Overrides:
- execute in interface Expression
- Parameters:
xctxt
- XPath runtime context.context
- The node being tested.
- Returns:
SCORE_NODETEST
,
- Throws:
TransformerException
-
public XObject execute(XPathContext xctxt, int context, DTM dtm, int expType) throws TransformerException
Tell what the test score is for the given node.SCORE_NONE
,SCORE_NSWILD
,SCORE_QNAME
, orSCORE_OTHER
.
- Overrides:
- execute in interface Expression
- Parameters:
xctxt
- XPath runtime context.context
- The node being tested.
- Returns:
SCORE_NODETEST
,
- Throws:
TransformerException
-
public void fixupVariables(java.util.Vector vars, int globalsSize)
Node tests by themselves do not need to fix up variables.
- Overrides:
- fixupVariables in interface Expression
public double getDefaultScore()
Get the score that this test will return if a test succeeds.
- Returns:
- the score that this test will return if a test succeeds.
public String getLocalName()
Return the local name to be tested.
- Returns:
- the local name to be tested, or
WILD
, or an empty string.
public String getNamespace()
Return the namespace to be tested.
- Returns:
- The namespace to be tested for, or
WILD
, or null.
public static int getNodeTypeTest(int whatToShow)
Tell what node type to test, if not DTMFilter.SHOW_ALL.DTMFilter
.
- Parameters:
whatToShow
- Bit set defined mainly by
- Returns:
- the node type for the whatToShow. Since whatToShow can specify multiple types, it will return the first bit tested that is on, so the caller of this function should take care that this is the function they really want to call. If none of the known bits are set, this function will return zero.
public XNumber getStaticScore()
Get the static score for this node test.
- Returns:
- Should be one of the SCORE_XXX constants.
public int getWhatToShow()
This attribute determines which node types are accepted. These constants are defined in theNodeFilter
interface.
- Returns:
- bitset mainly defined in
NodeFilter
.
public void initNodeTest(int whatToShow)
Initialize this node test by setting the whatToShow property, and calculating the score that this test will return if a test succeeds.
- Parameters:
whatToShow
- Bit set defined mainly byNodeFilter
.
public void initNodeTest(int whatToShow, String namespace, String name)
Initialize this node test by setting the whatToShow property and the namespace and local name, and calculating the score that this test will return if a test succeeds.
- Parameters:
whatToShow
- Bit set defined mainly byNodeFilter
.namespace
- The namespace to be tested.name
- The local name to be tested.
public void setLocalName(String name)
Set the local name to be tested.
- Parameters:
name
- the local name to be tested, orWILD
, or an empty string.
public void setNamespace(String ns)
Set the namespace to be tested.
- Parameters:
ns
- The namespace to be tested for, orWILD
, or null.
public void setStaticScore(XNumber score)
Set the static score for this node test.
- Parameters:
score
- Should be one of the SCORE_XXX constants.
public void setWhatToShow(int what)
This attribute determines which node types are accepted. These constants are defined in theNodeFilter
interface.
- Parameters:
what
- bitset mainly defined inNodeFilter
.