com.lotus.xsl
Interface QueryEngineService


public abstract interface QueryEngineService

Classes that implement the QueryEngineService interface are responsible for querying nodes in XML documents or DOM trees, matching node patterns, and evaluating string expressions. DESIGN ISSUE: Should the Match pattern calls and the expression evaluation calls have their own interfaces?


Method Summary
 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).
 com.lotus.xsl.Node findAncestor(java.lang.String fromMatchPattern, java.lang.String countMatchPattern, com.lotus.xsl.Node context, com.lotus.xsl.Element namespaceContext)
          Given a 'from' pattern (ala xsl:number), a match pattern and a context, find the first ancestor that matches the pattern (including the context handed in).
 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.
 int matchAgainstPatterns(java.lang.String expression, com.lotus.xsl.Node node, com.lotus.xsl.Element namespaceContext)
          Match a node against a list of ancestryPatterns.
 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.
 java.util.Vector query(java.lang.String expression, java.net.URL location)
          Given a select pattern, query a filesystem for documents that qualify according to the given pattern.
 

Method Detail

query

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
Given a select pattern, query a DOM for elements and/or attributes. This works exactly the opposite of matchAgainstPattern, which starts from the target node and marches inward and outward, qualifying the element matches. Instead, this function starts from the anchor and marches left to right, traversing the tree until it finds the target node (which it then qualifies the same as matchAgainstPattern).
Parameters:
expression - The select expression.
contextNode - The node that "." expresses.
namespaceContext - The context in which namespaces in the queries are supposed to be expanded.
Returns:
A NodeList of nodes.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

query

public java.util.Vector query(java.lang.String expression,
                              java.net.URL location)
                       throws XSLProcessorException,
                              java.net.MalformedURLException,
                              java.io.FileNotFoundException,
                              java.io.IOException
Given a select pattern, query a filesystem for documents that qualify according to the given pattern. This works exactly the opposite of matchAgainstPattern, which starts from the target node and marches inward and outward, qualifying the element matches. Instead, this function starts from the anchor and marches left to right, traversing the tree until it finds the target node (which it then qualifies the same as matchAgainstPattern).
Parameters:
expression - The select expression.
contextNode - The node that "." expresses.
namespaceContext - The context in which namespaces in the queries are supposed to be expanded.
Returns:
A vector of URIs.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

getTargetElementStrings

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
Returns a vector of target element strings. If the input is "foo", return {"foo"}. If the input is "foo | doo", return {"foo", "doo"}. If the input is "x/foo", return {"foo"}. If the input is "x/foo | z/foo", return {"foo"} -- NOTE the two element names are combined! If the input is "id(xx)/x//z[@aName]//foo[zz]", return {"foo"}. If the input is "id(xx)/x//z[@aName]//foo[zz] | roo/foo", return {"foo"}. If the input is "id(xx)/x//z[@aName]//foo[zz] | roo/doo", return {"foo", "doo"}. If the input is "id(xx)/x//z[@aName]//*[zz]", return {"*"}.
Parameters:
pattern - Valid XSL pattern expression.
namespaceContext - The context in which namespaces in the queries are supposed to be expanded.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

matchAgainstPatterns

public int 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
Match a node against a list of ancestryPatterns.
Parameters:
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.
Returns:
Zero if no match, otherwise a specificity value.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

findAncestor

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
Given a match pattern and a context, find the first ancestor that matches the pattern (including the context handed in).
Parameters:
matchPatternString - The match pattern.
node - The node that "." expresses.
namespaceContext - The context in which namespaces in the queries are supposed to be expanded.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.

findAncestor

public com.lotus.xsl.Node findAncestor(java.lang.String fromMatchPattern,
                                       java.lang.String countMatchPattern,
                                       com.lotus.xsl.Node context,
                                       com.lotus.xsl.Element namespaceContext)
Given a 'from' pattern (ala xsl:number), a match pattern and a context, find the first ancestor that matches the pattern (including the context handed in).
Parameters:
matchPatternString - The match pattern.
node - The node that "." expresses.
namespaceContext - The context in which namespaces in the queries are supposed to be expanded.

getStringExpr

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
Given an expression and a context, return the results in a string.
Parameters:
expression - The string expression.
node - The node that "." expresses.
namespaceContext - The context in which namespaces in the queries are supposed to be expanded.
Throws:
XSLProcessorException - thrown if the active ProblemListener and XMLParserLiaison decide the error condition is severe enough to halt processing.