|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.xalan.xpath.XPath
The XPath class represents the semantic parse tree of the XPath pattern. It is the representation of the grammar which filters out the choice for replacement order of the production rules. In order to conserve memory and reduce object creation, the tree is represented as an array of integers: [op code][length][...] where strings are represented within the array as indexes into the token tree.
Field Summary | |
static int |
ELEMWILDCARD
**For advanced use only** [ELEMWILDCARD] Means ELEMWILDCARD ("*"), used instead of string index in some places. |
static int |
EMPTY
[EMPTY] Empty slot to indicate NULL. |
static int |
ENDOP
**For advanced use only** [ENDOP] Some operators may like to have a terminator. |
static int |
FROM_ANCESTORS
**For advanced use only** [FROM_stepType] [length, including predicates] [length of just the step, without the predicates] {node test} {predicates}? returns: XBoolean |
static int |
FROM_ANCESTORS_OR_SELF
|
static int |
FROM_ATTRIBUTES
|
static int |
FROM_CHILDREN
|
static int |
FROM_DESCENDANTS
|
static int |
FROM_DESCENDANTS_OR_SELF
|
static int |
FROM_FOLLOWING
|
static int |
FROM_FOLLOWING_SIBLINGS
|
static int |
FROM_NAMESPACE
|
static int |
FROM_PARENT
|
static int |
FROM_PRECEDING
|
static int |
FROM_PRECEDING_SIBLINGS
|
static int |
FROM_ROOT
|
static int |
FROM_SELF
|
static int |
FUNC_BOOLEAN
|
static int |
FUNC_CEILING
|
static int |
FUNC_CONCAT
|
static int |
FUNC_CONTAINS
|
static int |
FUNC_COUNT
|
static int |
FUNC_CURRENT
|
static int |
FUNC_DOCLOCATION
|
static int |
FUNC_EXT_ELEM_AVAILABLE
|
static int |
FUNC_EXT_FUNCTION_AVAILABLE
|
static int |
FUNC_FALSE
|
static int |
FUNC_FLOOR
|
static int |
FUNC_GENERATE_ID
|
static int |
FUNC_ID
|
static int |
FUNC_KEY
|
static int |
FUNC_LANG
|
static int |
FUNC_LAST
|
static int |
FUNC_LOCAL_PART
|
static int |
FUNC_NAMESPACE
|
static int |
FUNC_NORMALIZE_SPACE
|
static int |
FUNC_NOT
|
static int |
FUNC_NUMBER
|
static int |
FUNC_POSITION
|
static int |
FUNC_QNAME
|
static int |
FUNC_ROUND
|
static int |
FUNC_STARTS_WITH
|
static int |
FUNC_STRING
|
static int |
FUNC_STRING_LENGTH
|
static int |
FUNC_SUBSTRING
|
static int |
FUNC_SUBSTRING_AFTER
|
static int |
FUNC_SUBSTRING_BEFORE
|
static int |
FUNC_SUM
|
static int |
FUNC_SYSTEM_PROPERTY
|
static int |
FUNC_TRANSLATE
|
static int |
FUNC_TRUE
|
static int |
FUNC_UNPARSED_ENTITY_URI
|
static int |
LOCATIONPATHEX_ISSIMPLE
|
static int |
LOCATIONPATHEX_MASK
|
static int |
MAPINDEX_LENGTH
**For advanced use only** The length is always the opcode position + 1. |
static int |
MATCH_ANY_ANCESTOR
**For advanced use only** For match patterns. |
static int |
MATCH_ATTRIBUTE
**For advanced use only** For match patterns. |
static int |
MATCH_IMMEDIATE_ANCESTOR
**For advanced use only** For match patterns. |
static double |
MATCH_SCORE_NODETEST
**For advanced use only** The match score if the pattern consists of just a NodeTest. |
static double |
MATCH_SCORE_NONE
**For advanced use only** The match score if no match is made. |
static double |
MATCH_SCORE_NSWILD
**For advanced use only** The match score if the pattern pattern has the form NCName:*. |
static double |
MATCH_SCORE_OTHER
**For advanced use only** The match score if the pattern consists of something other than just a NodeTest or just a qname. |
static double |
MATCH_SCORE_QNAME
**For advanced use only** The match score if the pattern has the form of a QName optionally preceded by an @ character. |
static int |
NODENAME
**For advanced use only** [NODENAME] [index to ns token or EMPTY] [index to name token] returns: XBoolean |
static int |
NODETYPE_ANYELEMENT
**For advanced use only** [NODETYPE_ANY] No size or arguments. |
static int |
NODETYPE_COMMENT
**For advanced use only** [NODETYPE_COMMENT] No size or arguments. |
static int |
NODETYPE_NODE
**For advanced use only** [NODETYPE_NODE] No size or arguments. |
static int |
NODETYPE_PI
**For advanced use only** [NODETYPE_PI] [index to token] Note: must not overlap function OP number! returns: XBoolean |
static int |
NODETYPE_ROOT
**For advanced use only** [NODETYPE_ROOT] No size or arguments. |
static int |
NODETYPE_TEXT
**For advanced use only** [NODETYPE_TEXT] No size or arguments. |
static int |
OP_AND
**For advanced use only** [OP_AND] [length] {boolean expression} {boolean expression} returns: XBoolean |
static int |
OP_ARGUMENT
**For advanced use only** [OP_ARGUMENT] (Function argument.) [length] {expression} returns: XNodeSet XNumber XString XBoolean XRTree XObject |
static int |
OP_BOOL
**For advanced use only** [OP_BOOL] (cast operation) [length] {expression} returns: XBoolean |
static int |
OP_DIV
**For advanced use only** [OP_DIV] [length] {number expression} {number expression} returns: XNumber |
static int |
OP_EQUALS
**For advanced use only** [OP_EQUALS] [length] {expression} {expression} returns: XBoolean |
static int |
OP_EXTFUNCTION
**For advanced use only** [OP_EXTFUNCTION] (Extension function.) [length] [index to namespace token] [index to function name token] {OP_ARGUMENT}* returns: XNodeSet XNumber XString XBoolean XRTree XObject |
static int |
OP_FUNCTION
**For advanced use only** [OP_FUNCTION] [length] [FUNC_name] {OP_ARGUMENT}* [ENDOP] returns: XNodeSet XNumber XString XBoolean XRTree XObject |
static int |
OP_GROUP
**For advanced use only** [OP_GROUP] [length] {expression} returns: XNodeSet XNumber XString XBoolean XRTree XObject |
static int |
OP_GT
**For advanced use only** [OP_GT] (greater-than) [length] {number expression} {number expression} returns: XBoolean |
static int |
OP_GTE
**For advanced use only** [OP_GTE] (greater-than-or-equals) [length] {number expression} {number expression} returns: XBoolean |
static int |
OP_LITERAL
**For advanced use only** [OP_LITERAL] [3] [index to token] returns: XString |
static int |
OP_LOCATIONPATH
**For advanced use only** [OP_LOCATIONPATH] [length] {FROM_stepType} | {function}{predicate}* [ENDOP] (Note that element and attribute namespaces and names can be wildcarded '*'.) returns: XNodeSet |
static int |
OP_LOCATIONPATH_EX
|
static int |
OP_LOCATIONPATHPATTERN
**For advanced use only** [OP_UNION] [length] {PathExpr}+ returns: XNodeSet |
static int |
OP_LT
**For advanced use only** [OP_LT] (less-than) [length] {number expression} {number expression} returns: XBoolean |
static int |
OP_LTE
**For advanced use only** [OP_LTE] (less-than-or-equals) [length] {number expression} {number expression} returns: XBoolean |
static int |
OP_MATCHPATTERN
**For advanced use only** [OP_UNION] [length] {PathExpr}+ returns: XNodeSet |
static int |
OP_MINUS
**For advanced use only** [OP_MINUS] [length] {number expression} {number expression} returns: XNumber |
static int |
OP_MOD
**For advanced use only** [OP_MOD] [length] {number expression} {number expression} returns: XNumber |
static int |
OP_MULT
**For advanced use only** [OP_MULT] [length] {number expression} {number expression} returns: XNumber |
static int |
OP_NEG
**For advanced use only** [OP_NEG] [length] {number expression} returns: XNumber |
static int |
OP_NOTEQUALS
**For advanced use only** [OP_NOTEQUALS] [length] {expression} {expression} returns: XBoolean |
static int |
OP_NUMBER
**For advanced use only** [OP_NUMBER] (cast operation) [length] {expression} returns: XBoolean |
static int |
OP_NUMBERLIT
**For advanced use only** [OP_NUMBERLIT] (Number literal.) [3] [index to token] returns: XString |
static int |
OP_OR
**For advanced use only** [OP_OR] [length] {boolean expression} {boolean expression} returns: XBoolean |
static int |
OP_PLUS
**For advanced use only** [OP_PLUS] [length] {number expression} {number expression} returns: XNumber |
static int |
OP_PREDICATE
**For advanced use only** [OP_PREDICATE] [length] {expression} [ENDOP] (For safety) returns: XBoolean or XNumber |
static int |
OP_QUO
**For advanced use only** [OP_QUO] [length] {number expression} {number expression} returns: XNumber |
static int |
OP_STRING
**For advanced use only** [OP_STRING] (cast operation) [length] {expression} returns: XString |
static int |
OP_UNION
**For advanced use only** [OP_UNION] [length] {PathExpr}+ returns: XNodeSet |
static int |
OP_VARIABLE
**For advanced use only** [OP_VARIABLE] [3] [index to token] returns: XString |
static int |
OP_XPATH
**For advanced use only** [OP_XPATH] [length] {expression} returns: XNodeSet XNumber XString XBoolean XRTree XObject |
static java.lang.String |
PSEUDONAME_ANY
**For advanced use only** used mainly for keys in the pattern lookup table, for those nodes that don't have unique lookup values. |
static java.lang.String |
PSEUDONAME_COMMENT
**For advanced use only** used mainly for keys in the pattern lookup table, for those nodes that don't have unique lookup values. |
static java.lang.String |
PSEUDONAME_OTHER
**For advanced use only** used mainly for keys in the pattern lookup table, for those nodes that don't have unique lookup values. |
static java.lang.String |
PSEUDONAME_PI
**For advanced use only** used mainly for keys in the pattern lookup table, for those nodes that don't have unique lookup values. |
static java.lang.String |
PSEUDONAME_ROOT
**For advanced use only** used mainly for keys in the pattern lookup table, for those nodes that don't have unique lookup values. |
static java.lang.String |
PSEUDONAME_TEXT
**For advanced use only** used mainly for keys in the pattern lookup table, for those nodes that don't have unique lookup values. |
Constructor Summary | |
XPath()
Construct an XPath object. |
|
XPath(ProblemListener problemListener)
Construct a XPath, passing in a problem listener. |
Method Summary | |
XObject |
execute(XPathSupport execContext,
org.w3c.dom.Node context,
int opPos)
**For advanced use only** Execute the XPath object from a given opcode position. |
XObject |
execute(XPathSupport execContext,
org.w3c.dom.Node context,
int opPos,
NodeCallback callback,
java.lang.Object callbackInfo,
boolean stopAtFirst)
**For advanced use only** Execute the XPath object from a given opcode position, calling back to a NodeCallback interface as the nodes are found. |
XObject |
execute(XPathSupport execContext,
org.w3c.dom.Node contextNode,
PrefixResolver namespaceContext)
Given an expression and a context, evaluate the XPath and return the result. |
XObject |
execute(XPathSupport execContext,
org.w3c.dom.Node contextNode,
PrefixResolver namespaceContext,
NodeCallback callback,
java.lang.Object callbackInfo,
boolean stopAtFirst)
**Experimental** Given an expression and a context, evaluate the XPath and call the callback as nodes are found. |
int |
getArgLengthOfStep(int opPos)
**For advanced use only** Go to the first child of a given operation. |
static int |
getFirstChildPos(int opPos)
**For advanced use only** Go to the first child of a given operation. |
static int |
getFirstChildPosOfStep(int opPos)
**For advanced use only** Go to the first child of a given operation. |
double |
getMatchScore(XPathSupport execContext,
org.w3c.dom.Node context)
Get the match score of the given node. |
int |
getNextOpPos(int opPos)
**For advanced use only** Given an operation position, return the end position, i.e. |
static int |
getNextOpPos(int[] opMap,
int opPos)
**For advanced use only** Given an operation position, return the end position, i.e. |
int |
getOp(int opPos)
**For advanced use only** Given an operation position, return the current op. |
int[] |
getOpMap()
**For advanced use only** Get the opcode list that describes the XPath operations. |
java.lang.String |
getPatternString()
Get the pattern string. |
ProblemListener |
getProblemListener()
Get the problem listener property. |
java.util.Vector |
getTargetElementStrings()
**For advanced use only** This method is for building indexes of match patterns for fast lookup. |
java.lang.Object[] |
getTokenQueue()
**For advanced use only** Get the XPath as a list of tokens. |
int |
getTokenQueueSize()
**For advanced use only** Get size of the token queue. |
static int |
installFunction(java.lang.String name,
Function func)
Install a built-in function. |
void |
installFunction(java.lang.String name,
int funcIndex,
Function func)
Install a built-in function. |
XNodeSet |
locationPath(XPathSupport execContext,
org.w3c.dom.Node context,
int opPos,
NodeCallback callback,
java.lang.Object callbackInfo,
boolean stopAtFirst)
**For advanced use only** Execute a location path. |
XObject |
predicate(XPathSupport execContext,
org.w3c.dom.Node context,
int opPos)
**For advanced use only** Evaluate a predicate. |
void |
setProblemListener(ProblemListener l)
Set the problem listener property. |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final int MAPINDEX_LENGTH
public static final double MATCH_SCORE_NONE
public static final double MATCH_SCORE_QNAME
public static final double MATCH_SCORE_NSWILD
public static final double MATCH_SCORE_NODETEST
public static final double MATCH_SCORE_OTHER
public static final int ENDOP
public static final int EMPTY
public static final int ELEMWILDCARD
public static final int OP_XPATH
public static final int OP_OR
public static final int OP_AND
public static final int OP_NOTEQUALS
public static final int OP_EQUALS
public static final int OP_LTE
public static final int OP_LT
public static final int OP_GTE
public static final int OP_GT
public static final int OP_PLUS
public static final int OP_MINUS
public static final int OP_MULT
public static final int OP_DIV
public static final int OP_MOD
public static final int OP_QUO
public static final int OP_NEG
public static final int OP_STRING
public static final int OP_BOOL
public static final int OP_NUMBER
public static final int OP_UNION
public static final int OP_LITERAL
public static final int OP_VARIABLE
public static final int OP_GROUP
public static final int OP_NUMBERLIT
public static final int OP_ARGUMENT
public static final int OP_EXTFUNCTION
public static final int OP_FUNCTION
public static final int OP_LOCATIONPATH
public static final int LOCATIONPATHEX_MASK
public static final int LOCATIONPATHEX_ISSIMPLE
public static final int OP_LOCATIONPATH_EX
public static final int OP_PREDICATE
public static final int OP_MATCHPATTERN
public static final int OP_LOCATIONPATHPATTERN
public static final int NODETYPE_COMMENT
public static final int NODETYPE_TEXT
public static final int NODETYPE_PI
public static final int NODETYPE_NODE
public static final int NODENAME
public static final int NODETYPE_ROOT
public static final int NODETYPE_ANYELEMENT
public static final int FROM_ANCESTORS
public static final int FROM_ANCESTORS_OR_SELF
public static final int FROM_ATTRIBUTES
public static final int FROM_CHILDREN
public static final int FROM_DESCENDANTS
public static final int FROM_DESCENDANTS_OR_SELF
public static final int FROM_FOLLOWING
public static final int FROM_FOLLOWING_SIBLINGS
public static final int FROM_PARENT
public static final int FROM_PRECEDING
public static final int FROM_PRECEDING_SIBLINGS
public static final int FROM_SELF
public static final int FROM_NAMESPACE
public static final int FROM_ROOT
public static final int FUNC_CURRENT
public static final int FUNC_LAST
public static final int FUNC_POSITION
public static final int FUNC_COUNT
public static final int FUNC_ID
public static final int FUNC_KEY
public static final int FUNC_LOCAL_PART
public static final int FUNC_NAMESPACE
public static final int FUNC_QNAME
public static final int FUNC_GENERATE_ID
public static final int FUNC_NOT
public static final int FUNC_TRUE
public static final int FUNC_FALSE
public static final int FUNC_BOOLEAN
public static final int FUNC_NUMBER
public static final int FUNC_FLOOR
public static final int FUNC_CEILING
public static final int FUNC_ROUND
public static final int FUNC_SUM
public static final int FUNC_STRING
public static final int FUNC_STARTS_WITH
public static final int FUNC_CONTAINS
public static final int FUNC_SUBSTRING_BEFORE
public static final int FUNC_SUBSTRING_AFTER
public static final int FUNC_NORMALIZE_SPACE
public static final int FUNC_TRANSLATE
public static final int FUNC_CONCAT
public static final int FUNC_SUBSTRING
public static final int FUNC_STRING_LENGTH
public static final int FUNC_SYSTEM_PROPERTY
public static final int FUNC_LANG
public static final int FUNC_EXT_FUNCTION_AVAILABLE
public static final int FUNC_EXT_ELEM_AVAILABLE
public static final int FUNC_DOCLOCATION
public static final int FUNC_UNPARSED_ENTITY_URI
public static final int MATCH_ATTRIBUTE
public static final int MATCH_ANY_ANCESTOR
public static final int MATCH_IMMEDIATE_ANCESTOR
public static final java.lang.String PSEUDONAME_ANY
public static final java.lang.String PSEUDONAME_ROOT
public static final java.lang.String PSEUDONAME_TEXT
public static final java.lang.String PSEUDONAME_COMMENT
public static final java.lang.String PSEUDONAME_PI
public static final java.lang.String PSEUDONAME_OTHER
Constructor Detail |
public XPath(ProblemListener problemListener)
problemListener
- An interface whereby the caller
can listen for errors and warnings.public XPath()
Method Detail |
public java.lang.String getPatternString()
public java.lang.Object[] getTokenQueue()
public int getTokenQueueSize()
public int[] getOpMap()
public void setProblemListener(ProblemListener l)
l
- A ProblemListener interface.public ProblemListener getProblemListener()
public XObject execute(XPathSupport execContext, org.w3c.dom.Node contextNode, PrefixResolver namespaceContext) throws org.xml.sax.SAXException
execContext
- The execution context.contextNode
- The node that "." expresses.namespaceContext
- The context in which namespaces in the
XPath are supposed to be expanded.public XObject execute(XPathSupport execContext, org.w3c.dom.Node contextNode, PrefixResolver namespaceContext, NodeCallback callback, java.lang.Object callbackInfo, boolean stopAtFirst) throws org.xml.sax.SAXException
execContext
- The execution context.contextNode
- The node that "." expresses.namespaceContext
- The context in which namespaces in the
XPath are supposed to be expanded.callback
- Interface that implements the processLocatedNode method.callbackInfo
- Object that will be passed to the processLocatedNode method.stopAtFirst
- True if the search should stop once the first node in document
order is found.public double getMatchScore(XPathSupport execContext, org.w3c.dom.Node context) throws org.xml.sax.SAXException
context
- The current source tree context node.public void installFunction(java.lang.String name, int funcIndex, Function func)
name
- The unqualified name of the function.funcIndex
- The index of the function in the table.func
- A Implementation of an XPath Function object.public static int installFunction(java.lang.String name, Function func)
name
- The unqualified name of the function.func
- A Implementation of an XPath Function object.public XNodeSet locationPath(XPathSupport execContext, org.w3c.dom.Node context, int opPos, NodeCallback callback, java.lang.Object callbackInfo, boolean stopAtFirst) throws org.xml.sax.SAXException
context
- The current source tree context node.opPos
- The current position in the m_opMap array.callback
- Interface that implements the processLocatedNode method.callbackInfo
- Object that will be passed to the processLocatedNode method.public XObject predicate(XPathSupport execContext, org.w3c.dom.Node context, int opPos) throws org.xml.sax.SAXException
context
- The current source tree context node.opPos
- The current position in the m_opMap array.public java.util.Vector getTargetElementStrings()
public XObject execute(XPathSupport execContext, org.w3c.dom.Node context, int opPos) throws org.xml.sax.SAXException
execContext
- The execution context.context
- The current source tree context node.opPos
- The current position in the xpath.m_opMap array.callback
- Interface that implements the processLocatedNode method.callbackInfo
- Object that will be passed to the processLocatedNode method.public XObject execute(XPathSupport execContext, org.w3c.dom.Node context, int opPos, NodeCallback callback, java.lang.Object callbackInfo, boolean stopAtFirst) throws org.xml.sax.SAXException
execContext
- The execution context.context
- The current source tree context node.opPos
- The current position in the xpath.m_opMap array.callback
- Interface that implements the processLocatedNode method.callbackInfo
- Object that will be passed to the processLocatedNode method.public int getOp(int opPos)
public int getNextOpPos(int opPos)
public static int getNextOpPos(int[] opMap, int opPos)
public static int getFirstChildPos(int opPos)
public int getArgLengthOfStep(int opPos)
public static int getFirstChildPosOfStep(int opPos)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |