|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.lotus.xsl.QueryEngine
This class queries a DOM tree, and performs other services relating to XSL Expressions such as pattern matching. The engine primarily does a a level-order traversal of the node tree from the given context (as opposed to a preorder traversal... the position(), count(), and last() functions along with multiple predicates make this hard), based upon the given XSL pattern, collecting the nodes into a vector. It uses the token structure in raw form, sliding up and down the token structure as it traverses and recursis into the nodes. The design hypothesis used is that the optimization gained by pre-tokenizing into a bunch of intelligent objects, as can be seen in some other XSL designs (including some previous incarnations of this engine), can actually be counter-productive in web-sized documents. In other words, I -tried- to keep it very simple and not allocate a bunch of objects along the way. From the experience so far, I'm not happy with the performance, so maybe my hypothesis is somewhat flawed. It looks like I will probably need to create some sort of smart token queue somewhat akin to compiled code, which I can then return to the caller.
Field Summary | |
static int |
CLASS_BOOLEAN
|
static int |
CLASS_DONTCARE
|
static int |
CLASS_NODESET
|
static int |
CLASS_NULL
|
static int |
CLASS_NUMBER
|
static int |
CLASS_RTREEFRAG
|
static int |
CLASS_STRING
|
static boolean |
m_debug
If this is true, extra programmer error checks will be made. |
static boolean |
m_trace
If m_trace is set to true, trace strings will be written out to System.out. |
static int |
MATCH_SCORE_NODETEST
The match score if the pattern consists of just a NodeTest. |
static int |
MATCH_SCORE_NONE
The match score if no match is made. |
static int |
MATCH_SCORE_OTHER
The match score if the pattern consists of something other than just a NodeTest or just a qname. |
static int |
MATCH_SCORE_QNAME
The match score if the pattern has the form of a QName optionally preceded by an @ character. |
Method Summary | |
com.lotus.xsl.NodeListImpl |
AbsoluteLocationPath(com.lotus.xsl.Node context,
com.lotus.xsl.NodeListImpl queryResults,
boolean isURI)
-------------------------------------------------------------------------------- AbsoluteLocationPath ::= '/' RelativeLocationPath? | AbbreviatedAbsoluteLocationPath -------------------------------------------------------------------------------- |
boolean |
booleanCast(java.lang.Object obj)
Cast result object to a boolean. |
java.lang.Object |
castToType(java.lang.Object obj,
int t)
Cast object to type t. |
void |
error(com.lotus.xsl.Node sourceNode,
java.lang.String msg)
Tell the user of an error, and probably throw an exception. |
void |
error(java.lang.String msg)
Tell the user of an error, and probably throw an exception. |
com.lotus.xsl.Node |
findAncestor(java.lang.String matchPatternString,
com.lotus.xsl.Node context,
com.lotus.xsl.Element namespaceContext)
Given a match pattern and a context, find the first ancestor that matches the pattern (including the context handed in). |
int |
getClassType(java.lang.Object obj)
Given an expression object, return what type of class it is... |
com.lotus.xsl.Document |
getDocByURL(com.lotus.xsl.Node context,
java.lang.String url)
Get a document identified by a URL, parsing it if necessary. |
com.lotus.xsl.Element |
getElementByID(com.lotus.xsl.Node context,
java.lang.String id)
Get a document identified by a URL, parsing it if necessary. |
java.lang.Object |
getExpr(Expression expression,
com.lotus.xsl.Node contextNode,
com.lotus.xsl.Element namespaceContext,
com.lotus.xsl.NodeList contextNodeList)
Given an expression and a context, return the result, without casting to any specific type. |
java.lang.Object |
getExpr(java.lang.String expression,
com.lotus.xsl.Node contextNode,
com.lotus.xsl.Element namespaceContext,
com.lotus.xsl.NodeList contextNodeList)
Given an expression and a context, return the result, without casting to any specific type. |
java.lang.String |
getStringExpr(java.lang.String expression,
com.lotus.xsl.Node contextNode,
com.lotus.xsl.Element namespaceContext)
Given an expression and a context, return the results in a string. |
java.util.Vector |
getTargetElementStrings(java.lang.String expression,
com.lotus.xsl.Element namespaceContext)
Returns a vector of target element strings. |
java.util.Vector |
getTargetElementStrings(java.lang.String expression,
com.lotus.xsl.Element namespaceContext,
Expression[] expressionHolder)
Returns a vector of target element strings. |
boolean |
isNodeAfter(com.lotus.xsl.Node node1,
com.lotus.xsl.Node node2)
Figure out if node2 should be placed after node1 when placing nodes in a list that is to be sorted in document order. |
double |
matchAgainstPatterns(Expression expression,
com.lotus.xsl.Node node,
com.lotus.xsl.Element namespaceContext)
Match a node against a list of ancestryPatterns. |
double |
matchAgainstPatterns(java.lang.String expression,
com.lotus.xsl.Node node,
com.lotus.xsl.Element namespaceContext)
Match a node against a list of ancestryPatterns. |
java.util.Vector |
nodelistCast(java.lang.Object obj)
Cast result object to a nodelist. |
double |
numberCast(java.lang.Object obj)
Cast result object to a number. |
com.lotus.xsl.NodeList |
query(Expression expression,
com.lotus.xsl.Node contextNode,
com.lotus.xsl.Element namespaceContext)
Given a select pattern, query a DOM for elements and/or attributes. |
com.lotus.xsl.NodeList |
query(com.lotus.xsl.Node contextNode,
com.lotus.xsl.Element namespaceContext)
Given a select pattern, query a DOM for elements and/or attributes. |
com.lotus.xsl.NodeList |
query(java.lang.String expression,
com.lotus.xsl.Node contextNode,
com.lotus.xsl.Element namespaceContext)
Given a select pattern, query a DOM for elements and/or attributes. |
com.lotus.xsl.DocumentFragment |
rtreefragCast(java.lang.Object obj)
Cast result object to a result tree fragment. |
java.lang.String |
stringCast(java.lang.Object obj)
Cast result object to a string. |
void |
warn(com.lotus.xsl.Node sourceNode,
java.lang.String msg)
Warn the user of an problem. |
void |
warn(java.lang.String msg)
Warn the user of an problem. |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final boolean m_debug
public static final boolean m_trace
public static final int MATCH_SCORE_NONE
public static final int MATCH_SCORE_QNAME
public static final int MATCH_SCORE_NODETEST
public static final int MATCH_SCORE_OTHER
public static final int CLASS_NULL
public static final int CLASS_DONTCARE
public static final int CLASS_BOOLEAN
public static final int CLASS_NUMBER
public static final int CLASS_STRING
public static final int CLASS_NODESET
public static final int CLASS_RTREEFRAG
Method Detail |
public com.lotus.xsl.NodeList query(Expression expression, com.lotus.xsl.Node contextNode, com.lotus.xsl.Element namespaceContext) throws XSLProcessorException, java.net.MalformedURLException, java.io.FileNotFoundException, java.io.IOException
expression
- The select expression.contextNode
- The node that "." expresses.namespaceContext
- The context in which namespaces in the
queries are supposed to be expanded.public com.lotus.xsl.NodeList query(java.lang.String expression, com.lotus.xsl.Node contextNode, com.lotus.xsl.Element namespaceContext) throws XSLProcessorException, java.net.MalformedURLException, java.io.FileNotFoundException, java.io.IOException
expression
- The select expression.contextNode
- The node that "." expresses.namespaceContext
- The context in which namespaces in the
queries are supposed to be expanded.public com.lotus.xsl.NodeList query(com.lotus.xsl.Node contextNode, com.lotus.xsl.Element namespaceContext) throws XSLProcessorException, java.net.MalformedURLException, java.io.FileNotFoundException, java.io.IOException
expression
- The select expression.contextNode
- The node that "." expresses.namespaceContext
- The context in which namespaces in the
queries are supposed to be expanded.public java.util.Vector getTargetElementStrings(java.lang.String expression, com.lotus.xsl.Element namespaceContext, Expression[] expressionHolder) throws XSLProcessorException, java.net.MalformedURLException, java.io.FileNotFoundException, java.io.IOException
pattern
- Valid XSL pattern expression.namespaceContext
- The context in which namespaces in the
queries are supposed to be expanded.public java.util.Vector getTargetElementStrings(java.lang.String expression, com.lotus.xsl.Element namespaceContext) throws XSLProcessorException, java.net.MalformedURLException, java.io.FileNotFoundException, java.io.IOException
pattern
- Valid XSL pattern expression.namespaceContext
- The context in which namespaces in the
queries are supposed to be expanded.public double matchAgainstPatterns(Expression expression, com.lotus.xsl.Node node, com.lotus.xsl.Element namespaceContext) throws XSLProcessorException, java.net.MalformedURLException, java.io.FileNotFoundException, java.io.IOException
expression
- The select expression.node
- The node that is being tested.namespaceContext
- The context in which namespaces in the
queries are supposed to be expanded.public double matchAgainstPatterns(java.lang.String expression, com.lotus.xsl.Node node, com.lotus.xsl.Element namespaceContext) throws XSLProcessorException, java.net.MalformedURLException, java.io.FileNotFoundException, java.io.IOException
expression
- The select expression.node
- The node that is being tested.namespaceContext
- The context in which namespaces in the
queries are supposed to be expanded.public com.lotus.xsl.Node findAncestor(java.lang.String matchPatternString, com.lotus.xsl.Node context, com.lotus.xsl.Element namespaceContext) throws XSLProcessorException, java.net.MalformedURLException, java.io.FileNotFoundException, java.io.IOException
matchPatternString
- The match pattern.node
- The node that "." expresses.namespaceContext
- The context in which namespaces in the
queries are supposed to be expanded.public java.lang.String getStringExpr(java.lang.String expression, com.lotus.xsl.Node contextNode, com.lotus.xsl.Element namespaceContext) throws XSLProcessorException, java.net.MalformedURLException, java.io.FileNotFoundException, java.io.IOException
expression
- The string expression.node
- The node that "." expresses.namespaceContext
- The context in which namespaces in the
queries are supposed to be expanded.public java.lang.Object getExpr(java.lang.String expression, com.lotus.xsl.Node contextNode, com.lotus.xsl.Element namespaceContext, com.lotus.xsl.NodeList contextNodeList) throws XSLProcessorException, java.net.MalformedURLException, java.io.FileNotFoundException, java.io.IOException
expression
- The expression.node
- The node that "." expresses.namespaceContext
- The context in which namespaces in the
queries are supposed to be expanded.public java.lang.Object getExpr(Expression expression, com.lotus.xsl.Node contextNode, com.lotus.xsl.Element namespaceContext, com.lotus.xsl.NodeList contextNodeList) throws XSLProcessorException, java.net.MalformedURLException, java.io.FileNotFoundException, java.io.IOException
expression
- The expression.node
- The node that "." expresses.namespaceContext
- The context in which namespaces in the
queries are supposed to be expanded.public com.lotus.xsl.NodeListImpl AbsoluteLocationPath(com.lotus.xsl.Node context, com.lotus.xsl.NodeListImpl queryResults, boolean isURI) throws XSLProcessorException, java.net.MalformedURLException, java.io.FileNotFoundException, java.io.IOException
public boolean isNodeAfter(com.lotus.xsl.Node node1, com.lotus.xsl.Node node2)
public com.lotus.xsl.Document getDocByURL(com.lotus.xsl.Node context, java.lang.String url) throws XSLProcessorException, java.net.MalformedURLException, java.io.FileNotFoundException, java.io.IOException
public com.lotus.xsl.Element getElementByID(com.lotus.xsl.Node context, java.lang.String id) throws XSLProcessorException, java.net.MalformedURLException, java.io.FileNotFoundException, java.io.IOException
public int getClassType(java.lang.Object obj)
public double numberCast(java.lang.Object obj)
public boolean booleanCast(java.lang.Object obj)
public java.lang.String stringCast(java.lang.Object obj)
public com.lotus.xsl.DocumentFragment rtreefragCast(java.lang.Object obj)
public java.util.Vector nodelistCast(java.lang.Object obj)
public java.lang.Object castToType(java.lang.Object obj, int t)
public void warn(java.lang.String msg) throws QueryEngineException
public void warn(com.lotus.xsl.Node sourceNode, java.lang.String msg) throws QueryEngineException
public void error(java.lang.String msg) throws QueryEngineException
public void error(com.lotus.xsl.Node sourceNode, java.lang.String msg) throws QueryEngineException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |