Xalan-C++ API Documentation

The Xalan C++ XSL Transformer Version 1.1

Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

XPath Class Reference

The XPath class represents the semantic parse tree of the XPath pattern. More...

#include <XPath.hpp>

Collaboration diagram for XPath:

Collaboration graph

[legend]
List of all members.

Public Types

Public Methods

Static Public Methods

Static Public Attributes

Protected Methods


Detailed Description

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 indices into the token tree.


Member Typedef Documentation

typedef XPathFunctionTable XPath::FunctionTableType
 

typedef std::vector<XalanDOMString> XPath::TargetElementStringsVectorType
 


Constructor & Destructor Documentation

XPath::XPath ( bool createDefaultLocator = true ) [explicit]
 

Construct an XPath and optionally a default locator.

Parameters:
createDefaultLocator   true to create a default locator object, default true

virtual XPath::~XPath ( ) [virtual]
 


Member Function Documentation

const XObjectPtr XPath::And ( XalanNode * context,
int opPos,
XPathExecutionContext & executionContext ) const [protected]
 

OR two expressions and return the boolean result.

Parameters:
context   The current source tree context node.
opPos   The current position in the m_opMap array.
Returns:
XBoolean set to true if the two arguments are both true.

const XObjectPtr XPath::Or ( XalanNode * context,
int opPos,
XPathExecutionContext & executionContext ) const [protected]
 

OR two expressions and return the boolean result.

Parameters:
context   The current source tree context node.
opPos   The current position in the m_opMap array.
Returns:
XBoolean set to true if the one of the two arguments are true.

const XObjectPtr XPath::Union ( XalanNode * context,
int opPos,
XPathExecutionContext & executionContext ) const [protected]
 

Computes the union of its operands which must be node-sets.

Parameters:
context   The current source tree context node.
opPos   The current position in the m_opMap array.
Returns:
the union of node-set operands.

const XObjectPtr XPath::arg ( XalanNode * context,
int opPos,
XPathExecutionContext & executionContext ) const [protected]
 

Execute a function argument.

Parameters:
context   The current source tree context node.
opPos   The current position in the m_opMap array.
Returns:
the result of the argument expression.

const XObjectPtr XPath::boolean ( XalanNode * context,
int opPos,
XPathExecutionContext & executionContext ) const [protected]
 

Cast an expression to a boolean.

Parameters:
context   The current source tree context node.
opPos   The current position in the m_opMap array.
Returns:
arg cast to a boolean.

XLocator * XPath::createXLocatorHandler ( ) const [protected, virtual]
 

createXLocatorHandler.

void XPath::destroyTable ( ) [static]
 

const XObjectPtr XPath::div ( XalanNode * context,
int opPos,
XPathExecutionContext & executionContext ) const [protected]
 

Divide a number.

Parameters:
context   The current source tree context node.
opPos   The current position in the m_opMap array.
Returns:
arg1 / arg2.

const XObjectPtr XPath::equals ( XalanNode * context,
int opPos,
XPathExecutionContext & executionContext ) const [protected]
 

Tell if two expressions are functionally equal.

Parameters:
context   The current source tree context node.
opPos   The current position in the m_opMap array.
Returns:
XBoolean set to true if the two arguments are equal.

const XObjectPtr XPath::execute ( XPathExecutionContext & executionContext ) const [virtual]
 

Execute the XPath from the provided context.

The prefix resolver must already be set in the execution context.

Parameters:
executionContext   current execution context
Returns:
pointer to result XObject

const XObjectPtr XPath::execute ( XalanNode * context,
const PrefixResolver & prefixResolver,
const NodeRefListBase & contextNodeList,
XPathExecutionContext & executionContext ) const [virtual]
 

Execute the XPath from the provided context.

Parameters:
context   current source tree context node
prefixResolver   prefix resolver to use
contextNodeList   node list for current context
executionContext   current execution context
Returns:
pointer to union of node-set operands

const XObjectPtr XPath::execute ( XalanNode * context,
const PrefixResolver & prefixResolver,
XPathExecutionContext & executionContext ) const [virtual]
 

Execute the XPath from the provided context.

Parameters:
context   current source tree context node
prefixResolver   prefix resolver to use
executionContext   current execution context
Returns:
pointer to union of node-set operands

const XObjectPtr XPath::executeMore ( XalanNode * context,
int opPos,
XPathExecutionContext & executionContext ) const [virtual]
 

Execute the XPath from the provided context.

Parameters:
context   current source tree context node
opPos   current position in the m_opMap array
executionContext   current execution context
Returns:
pointer to union of node-set operands

const XObjectPtr XPath::extfunction ( XalanNode * context,
int opPos,
const XalanDOMString & theNamespace,
const XalanDOMString & functionName,
const Function::XObjectArgVectorType & argVec,
XPathExecutionContext & executionContext ) const [protected]
 

Handle an extension function.

const XObjectPtr XPath::function ( XalanNode * context,
int opPos,
int funcID,
const Function::XObjectArgVectorType & argVec,
XPathExecutionContext & executionContext ) const [protected]
 

Handle a built-in function.

const XPathExpression & XPath::getExpression ( ) const []
 

Retrieve a reference to the current expression.

Returns:
current expression

XPathExpression & XPath::getExpression ( ) []
 

Retrieve a reference to the current expression.

Returns:
current expression

const FunctionTableType & XPath::getFunctionTable ( ) [static]
 

Retrieve the table of installed functions.

Returns:
function table

bool XPath::getInStylesheet ( ) const []
 

template<classOutputIteratorType>
void XPath::getInstalledFunctionNames ( OutputIteratorType theIterator ) [static]
 

Add the names for the installed functions to a vector strings.

Parameters:
theIterator   vector added to

double XPath::getMatchScore ( XalanNode * context,
const PrefixResolver & resolver,
XPathExecutionContext & executionContext ) const [virtual]
 

Computes the union of its operands which must be node-sets.

Parameters:
context   current source tree context node
executionContext   current execution context
Returns:
union of node-set operands

void XPath::getTargetElementStrings ( TargetElementStringsVectorType & targetStrings ) const [virtual]
 

Add the strings for the target element to a vector of strings.

Parameters:
targetStrings   vector of strings

const XObjectPtr XPath::group ( XalanNode * context,
int opPos,
XPathExecutionContext & executionContext ) const [protected]
 

Execute an expression as a group.

Parameters:
context   The current source tree context node.
opPos   The current position in the m_opMap array.
Returns:
arg.

const XObjectPtr XPath::gt ( XalanNode * context,
int opPos,
XPathExecutionContext & executionContext ) const [protected]
 

Tell if one argument is greater than the other argument.

Parameters:
context   The current source tree context node.
opPos   The current position in the m_opMap array.
Returns:
XBoolean set to true if arg 1 is greater than arg 2.

const XObjectPtr XPath::gte ( XalanNode * context,
int opPos,
XPathExecutionContext & executionContext ) const [protected]
 

Tell if one argument is greater than or equal to the other argument.

Parameters:
context   The current source tree context node.
opPos   The current position in the m_opMap array.
Returns:
XBoolean set to true if arg 1 is greater than or equal to arg 2.

void XPath::initialize ( ) [static]
 

Perform static initialization.

See class XPathInit.

void XPath::installFunction ( const XalanDOMString & funcName,
const Function & func ) [static]
 

Install a built-in function.

Parameters:
funcName   unqualified name of the function
func   instance of an XPath function object

bool XPath::isInstalledFunction ( const XalanDOMString & theFunctionName ) [static]
 

Whether the named function is installed in the function table.

Parameters:
name   of function
Returns:
true if the function has been installed

const XObjectPtr XPath::literal ( XalanNode * context,
int opPos,
XPathExecutionContext & executionContext ) const [protected]
 

Get a literal value.

Parameters:
context   The current source tree context node.
opPos   The current position in the m_opMap array.
Returns:
an XObject object.

const XObjectPtr XPath::locationPath ( XalanNode * context,
int opPos,
XPathExecutionContext & executionContext ) const [virtual]
 

Execute a location path.

Parameters:
context   current source tree context node
opPos   current position in the m_opMap array
executionContext   current execution context
Returns:
node-set

const XObjectPtr XPath::locationPathPattern ( XalanNode * context,
int opPos,
XPathExecutionContext & executionContext ) const [protected]
 

Execute a location path.

Parameters:
context   The current source tree context node.
opPos   The current position in the m_opMap array.
Returns:
score in an XNumber, one of MATCH_SCORE_NODETEST, MATCH_SCORE_NONE, MATCH_SCORE_OTHER, MATCH_SCORE_QNAME.

const XObjectPtr XPath::lt ( XalanNode * context,
int opPos,
XPathExecutionContext & executionContext ) const [protected]
 

Tell if one argument is less than the other argument.

Parameters:
context   The current source tree context node.
opPos   The current position in the m_opMap array.
Returns:
XBoolean set to true if arg 1 is less than arg 2.

const XObjectPtr XPath::lte ( XalanNode * context,
int opPos,
XPathExecutionContext & executionContext ) const [protected]
 

Tell if one argument is less than or equal to the other argument.

Parameters:
context   The current source tree context node.
opPos   The current position in the m_opMap array.
Returns:
XBoolean set to true if arg 1 is less than or equal to arg 2.

const XObjectPtr XPath::matchPattern ( XalanNode * context,
int opPos,
XPathExecutionContext & executionContext ) const [protected, virtual]
 

Computes the union of its operands which must be node-sets.

Parameters:
context   The current source tree context node.
opPos   The current position in the m_opMap array.
Returns:
the match score in the form of an XObject.

const XObjectPtr XPath::minus ( XalanNode * context,
int opPos,
XPathExecutionContext & executionContext ) const [protected]
 

Give the difference of two arguments.

Parameters:
context   The current source tree context node.
opPos   The current position in the m_opMap array.
Returns:
difference of arg1 and arg2.

const XObjectPtr XPath::mod ( XalanNode * context,
int opPos,
XPathExecutionContext & executionContext ) const [protected]
 

Return the remainder from a truncating division.

Parameters:
context   The current source tree context node.
opPos   The current position in the m_opMap array.
Returns:
arg1 mod arg2.

const XObjectPtr XPath::mult ( XalanNode * context,
int opPos,
XPathExecutionContext & executionContext ) const [protected]
 

Multiply two arguments.

Parameters:
context   The current source tree context node.
opPos   The current position in the m_opMap array.
Returns:
arg1 * arg2.

const XObjectPtr XPath::neg ( XalanNode * context,
int opPos,
XPathExecutionContext & executionContext ) const [protected]
 

Return the negation of a number.

Parameters:
context   The current source tree context node.
opPos   The current position in the m_opMap array.
Returns:
-arg.

double XPath::nodeTest ( XalanNode * context,
int opPos,
int argLen,
int stepType,
XPathExecutionContext & executionContext ) const [virtual]
 

Test a node.

This should be implemented by a derived class. Returns s_MatchScoreNone by default.

Parameters:
context   current source tree context node
opPos   current position in the m_opMap array
argLen   argument length
stepType   type of step
executionContext   current execution context
Returns:
one of s_MatchScoreNone, s_MatchScoreNodeTest, s_MatchScoreQName

const XObjectPtr XPath::notequals ( XalanNode * context,
int opPos,
XPathExecutionContext & executionContext ) const [protected]
 

Tell if two expressions are functionally not equal.

Parameters:
context   The current source tree context node.
opPos   The current position in the m_opMap array.
Returns:
XBoolean set to true if the two arguments are not equal.

const XObjectPtr XPath::number ( XalanNode * context,
int opPos,
XPathExecutionContext & executionContext ) const [protected]
 

Cast an expression to a number.

Parameters:
context   The current source tree context node.
opPos   The current position in the m_opMap array.
Returns:
arg cast to a number.

const XObjectPtr XPath::numberlit ( XalanNode * context,
int opPos,
XPathExecutionContext & executionContext ) const [protected]
 

Get a literal value.

Parameters:
context   The current source tree context node.
opPos   The current position in the m_opMap array.
Returns:
an XObject object.

const XObjectPtr XPath::plus ( XalanNode * context,
int opPos,
XPathExecutionContext & executionContext ) const [protected]
 

Give the sum of two arguments.

Parameters:
context   The current source tree context node.
opPos   The current position in the m_opMap array.
Returns:
sum of arg1 and arg2.

const XObjectPtr XPath::predicate ( XalanNode * context,
int opPos,
XPathExecutionContext & executionContext ) const [virtual]
 

Evaluate a predicate.

Parameters:
context   current source tree context node
opPos   current position in the m_opMap array
executionContext   current execution context
Returns:
pointer to either a boolean or a number

const XObjectPtr XPath::quo ( XalanNode * context,
int opPos,
XPathExecutionContext & executionContext ) const [protected]
 

Return the remainder from a truncating division.

(Quo is no longer supported by xpath).

Parameters:
context   The current source tree context node.
opPos   The current position in the m_opMap array.
Returns:
arg1 mod arg2.

const XObjectPtr XPath::runExtFunction ( XalanNode * context,
int opPos,
XPathExecutionContext & executionContext ) const [protected]
 

Setup for and run an extension function.

const XObjectPtr XPath::runFunction ( XalanNode * context,
int opPos,
XPathExecutionContext & executionContext ) const [protected]
 

Setup for and run a function.

void XPath::setInStylesheet ( bool fValue ) []
 

void XPath::shrink ( ) [virtual]
 

Shrink internal tables.

MutableNodeRefList * XPath::step ( XalanNode * context,
int opPos,
XPathExecutionContext & executionContext ) const [protected]
 

Execute a step in a location path.

This must be implemented by a derived class of XPath (or don't call at all from the derived implementation of locationPath()).

Parameters:
context   The current source tree context node.
opPos   The current position in the m_opMap array.
Returns:
a node-set.

const XObjectPtr XPath::string ( XalanNode * context,
int opPos,
XPathExecutionContext & executionContext ) const [protected]
 

Cast an expression to a string.

Parameters:
context   The current source tree context node.
opPos   The current position in the m_opMap array.
Returns:
arg cast to a string.

void XPath::terminate ( ) [static]
 

Perform static shut down.

See class XPathInit.

bool XPath::uninstallFunction ( const XalanDOMString & funcName ) [static]
 

Remove a named function from the function table.

Parameters:
funcName   name of function
Returns:
true if the function was found and removed.

const XObjectPtr XPath::variable ( XalanNode * context,
int opPos,
XPathExecutionContext & executionContext ) const [protected]
 

Get the value of a variable.

Parameters:
context   The current source tree context node.
opPos   The current position in the m_opMap array.
Returns:
an XObject object.

const XObjectPtr XPath::xpath ( XalanNode * context,
int opPos,
XPathExecutionContext & executionContext ) const [protected, virtual]
 

Execute from the beginning of the xpath.

Parameters:
context   The current source tree context node.
opPos   The current position in the m_opMap array.
Returns:
The result of the expression.


Member Data Documentation

const XalanDOMString & XPath::PSEUDONAME_ANY [static]
 

const XalanDOMString & XPath::PSEUDONAME_COMMENT [static]
 

const XalanDOMString & XPath::PSEUDONAME_OTHER [static]
 

const XalanDOMString & XPath::PSEUDONAME_PI [static]
 

const XalanDOMString & XPath::PSEUDONAME_ROOT [static]
 

const XalanDOMString & XPath::PSEUDONAME_TEXT [static]
 

const double XPath::s_MatchScoreNSWild [static]
 

The match score if the pattern has the form NCName:*.

const double XPath::s_MatchScoreNodeTest [static]
 

The match score if the pattern consists of just a NodeTest.

const double XPath::s_MatchScoreNone [static]
 

The match score if no match is made.

const double XPath::s_MatchScoreOther [static]
 

The match score if the pattern consists of something other than just a NodeTest or just a qname.

const double XPath::s_MatchScoreQName [static]
 

The match score if the pattern has the form of a QName optionally preceded by an @ character.


The documentation for this class was generated from the following file:

Interpreting class diagrams

Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.

Xalan-C++ XSL Transformer Version 1.1
Copyright © 2000, 2001 The Apache Software Foundation. All Rights Reserved.