This is the basic node test class for both match patterns and location path
steps.
SCORE_NODETEST
public static final XNumber SCORE_NODETEST
The match score if the pattern consists of just a NodeTest.
SCORE_NONE
public static final XNumber SCORE_NONE
The match score if no match is made.
SCORE_NSWILD
public static final XNumber SCORE_NSWILD
The match score if the pattern pattern has the form NCName:*.
SCORE_OTHER
public static final XNumber SCORE_OTHER
The match score if the pattern consists of something
other than just a NodeTest or just a qname.
SCORE_QNAME
public static final XNumber SCORE_QNAME
The match score if the pattern has the form
of a QName optionally preceded by an @ character.
SHOW_BYFUNCTION
public static final int SHOW_BYFUNCTION
Special bitmap for match patterns starting with a function.
Make sure this does not conflict with org.w3c.dom.traversal.NodeFilter
.
SUPPORTS_PRE_STRIPPING
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.
WILD
public static final String WILD
The namespace or local name for node tests with a wildcard.
debugWhatToShow
public static void debugWhatToShow(int whatToShow)
Do a diagnostics dump of a whatToShow bit set.
whatToShow
- Bit set defined mainly by
DTMFilter
.
fixupVariables
public void fixupVariables(Vector vars,
int globalsSize)
Node tests by themselves do not need to fix up variables.
- fixupVariables in interface Expression
getDefaultScore
public double getDefaultScore()
Get the score that this test will return if a test succeeds.
- the score that this test will return if a test succeeds.
getLocalName
public String getLocalName()
Return the local name to be tested.
- the local name to be tested, or
WILD
, or an empty string.
getNamespace
public String getNamespace()
Return the namespace to be tested.
- The namespace to be tested for, or
WILD
, or null.
getNodeTypeTest
public static int getNodeTypeTest(int whatToShow)
Tell what node type to test, if not DTMFilter.SHOW_ALL.
whatToShow
- Bit set defined mainly by
DTMFilter
.
- 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.
getStaticScore
public XNumber getStaticScore()
Get the static score for this node test.
- Should be one of the SCORE_XXX constants.
getWhatToShow
public int getWhatToShow()
This attribute determines which node types are accepted.
These constants are defined in the org.w3c.dom.traversal.NodeFilter
interface.
- bitset mainly defined in
org.w3c.dom.traversal.NodeFilter
.
initNodeTest
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.
whatToShow
- Bit set defined mainly by org.w3c.dom.traversal.NodeFilter
.
initNodeTest
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.
whatToShow
- Bit set defined mainly by org.w3c.dom.traversal.NodeFilter
.namespace
- The namespace to be tested.name
- The local name to be tested.
setLocalName
public void setLocalName(String name)
Set the local name to be tested.
name
- the local name to be tested, or WILD
, or an empty string.
setNamespace
public void setNamespace(String ns)
Set the namespace to be tested.
ns
- The namespace to be tested for, or WILD
, or null.
setStaticScore
public void setStaticScore(XNumber score)
Set the static score for this node test.
score
- Should be one of the SCORE_XXX constants.
setWhatToShow
public void setWhatToShow(int what)
This attribute determines which node types are accepted.
These constants are defined in the org.w3c.dom.traversal.NodeFilter
interface.
what
- bitset mainly defined in org.w3c.dom.traversal.NodeFilter
.