## Xalan-C++ API Documentation

### The Xalan C++ XSLT Processor Version 1.6

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

# XPathExecutionContext Class Reference

`#include <XPathExecutionContext.hpp>`

Inheritance diagram for XPathExecutionContext

Collaboration diagram for XPathExecutionContext:

List of all members.

## Public Types

- typedef std::vector<XObjectPtr> XObjectArgVectorType
- typedef NodeRefListBase::size_type size_type

## Public Methods

- XPathExecutionContext (XObjectFactory* theXObjectFactory = 0)
- virtual ~XPathExecutionContext ()
- virtual void reset () = 0
    Reset the instance. More...
- virtual XalanNode* getCurrentNode () const = 0
    Retrieve the node currently being executed. More...
- virtual void setCurrentNode (XalanNode* theCurrentNode) = 0
    Change the node currently being executed. More...
- XObjectFactory& getXObjectFactory () const
    Retrieve the factory object for creating XObjects. More...
- virtual bool isNodeAfter ( const XalanNode& node1, const XalanNode& node2) const = 0
    Determine if a node is after another node, in document order. More...
- virtual const NodeRefListBase& getContextNodeList () const = 0
    Retrieve node list for current context. More...
- virtual void setContextNodeList (const NodeRefListBase& theList) = 0
    Set node list for current context. More...
- virtual size_type getContextNodeListLength () const = 0
- virtual size_type getContextNodeListPosition (const XalanNode& contextNode) const = 0
- virtual bool elementAvailable (const XalanQName& theQName) const = 0
    Determine if an external element is available. More...
- virtual bool elementAvailable ( const XalanDOMString& theName, const LocatorType* locator) const = 0
    Determine if an external element is available by resolving a string to a QName. More...
- virtual bool functionAvailable (const XalanQName& theQName) const = 0
    Determine if a function is available. More...
- virtual bool functionAvailable ( const XalanDOMString& theName, const LocatorType* locator) const = 0
    Determine if a function is available. More...
- virtual const XObjectPtr extFunction ( const XalanDOMString& theNamespace, const XalanDOMString& functionName, XalanNode* context, const XObjectArgVectorType& argVec, const LocatorType* locator) = 0
    Handle an extension function. More...
- virtual XalanDocument* parseXML ( const XalanDOMString& urlString, const XalanDOMString& base) const = 0
    Provides support for XML parsing service. More...
- virtual MutableNodeRefList* borrowMutableNodeRefList () = 0
    Borrow a cached MutableNodeRefList instance. More...
- virtual bool returnMutableNodeRefList (MutableNodeRefList* theList) = 0
    Return a previously borrowed MutableNodeRefList instance. More...
- virtual XalanDOMString& getCachedString () = 0
    Get a cached string for temporary use. More...
- virtual bool releaseCachedString (XalanDOMString& theString) = 0
    Return a cached string. More...
- virtual MutableNodeRefList* createMutableNodeRefList () const = 0
    Create a MutableNodeRefList with the appropriate context. More...
- virtual void getNodeSetByKey ( XalanDocument* doc, const XalanQName& qname, const XalanDOMString& ref, MutableNodeRefList& nodelist) = 0
    Given a valid element key, return the corresponding node list. More...
- virtual void getNodeSetByKey ( XalanDocument* doc, const XalanDOMString& name, const XalanDOMString& ref, const LocatorType* locator, MutableNodeRefList& nodelist) = 0
    Given a valid element key, return the corresponding node list. More...
- virtual const XObjectPtr getVariable ( const XalanQName& name, const LocatorType* locator = 0) = 0
    Given a name, locate a variable in the current context, and return a pointer to the object. More...
- virtual const PrefixResolver* getPrefixResolver () const = 0
    Retrieve the resolver for namespaces. More...
- virtual void setPrefixResolver (const PrefixResolver* thePrefixResolver) = 0
    Change the resolver for namespaces. More...
- virtual const XalanDOMString* getNamespaceForPrefix (const XalanDOMString& prefix) const = 0
    Retrieve the URI corresponding to a namespace prefix. More...
- virtual XalanDOMString findURIFromDoc (const XalanDocument* owner) const = 0
    Given a DOM Document, tell what URI was used to parse it. More...
- virtual const XalanDOMString& getUnparsedEntityURI ( const XalanDOMString& theName, const XalanDocument& theDocument) const = 0
    The getUnparsedEntityURI function returns the URI of the unparsed entity with the specified name in the same document as the context node (see [3.3 Unparsed Entities]). More...
- virtual bool shouldStripSourceNode (const XalanNode& node) = 0
    Tells, through the combination of the default-space attribute on xsl:stylesheet, xsl:strip-space, xsl:preserve-space, and the xml:space attribute, whether or not extra whitespace should be stripped from the node. More...
- virtual bool getThrowFoundIndex () const = 0
    Tells if FoundIndex should be thrown if index is found. More...
- virtual void setThrowFoundIndex (bool fThrow) = 0
    Changes whether FoundIndex should be thrown if index is found. More...
- virtual XalanDocument* getSourceDocument (const XalanDOMString& theURI) const = 0
- virtual void setSourceDocument ( const XalanDOMString& theURI, XalanDocument* theDocument) = 0
    Associate a document with a given URI. More...
- virtual const XalanDecimalFormatSymbols* getDecimalFormatSymbols (const XalanQName& qname) = 0
    Retrieve the XalanDecimalFormatSymbols instance associated with the name. More...
- virtual void error ( const XalanDOMString& msg, const XalanNode* sourceNode = 0, const LocatorType* locator = 0) const = 0
    Report an error and throw an exception. More...
- virtual void error ( const char* msg, const XalanNode* sourceNode = 0, const LocatorType* locator = 0) const = 0
    Report an error and throw an exception. More...
- virtual void warn ( const XalanDOMString& msg, const XalanNode* sourceNode = 0, const LocatorType* locator = 0) const = 0
    Report a warning. More...
- virtual void warn ( const char* msg, const XalanNode* sourceNode = 0, const LocatorType* locator = 0) const = 0
    Report a warning. More...
- virtual void message ( const XalanDOMString& msg, const XalanNode* sourceNode = 0, const LocatorType* locator = 0) const = 0
    Output a message. More...
- virtual void message ( const char* msg, const XalanNode* sourceNode = 0, const LocatorType* locator = 0) const = 0
    Output a message. More...

## Protected Attributes

- XObjectFactory* m_xobjectFactory

## Member Typedef Documentation

typedef std::vector<XObjectPtr> XPathExecutionContext::XObjectArgVectorType

typedef NodeRefListBase::size_type XPathExecutionContext::size_type

Reimplemented in StylesheetExecutionContext.

## Constructor & Destructor Documentation

XPathExecutionContext::XPathExecutionContext ( | XObjectFactory * theXObjectFactory = 0 )`[explicit]`

virtual XPathExecutionContext::~XPathExecutionContext ( | )`[virtual]`

## Member Function Documentation

MutableNodeRefList * XPathExecutionContext::borrowMutableNodeRefList ( | )`[pure virtual]`

Borrow a cached MutableNodeRefList instance.

Returns:
  A pointer to the instance.

Reimplemented in StylesheetExecutionContext, StylesheetExecutionContextDefault, and XPathExecutionContextDefault.

MutableNodeRefList * XPathExecutionContext::createMutableNodeRefList ( | ) const`[pure virtual]`

Create a MutableNodeRefList with the appropriate context.

Returns:
  pointer to node list created

Reimplemented in StylesheetExecutionContext, StylesheetExecutionContextDefault, and XPathExecutionContextDefault.

bool XPathExecutionContext::elementAvailable ( | const XalanDOMString & theName,
| const LocatorType * locator ) const`[pure virtual]`

Determine if an external element is available by resolving a string to a QName.

Parameters:

  theName | The name of the element
  locator | A LocatorType instance for error reporting

Returns:
  whether the given element is available or not

Reimplemented in StylesheetExecutionContext, StylesheetExecutionContextDefault, and XPathExecutionContextDefault.

bool XPathExecutionContext::elementAvailable ( | const XalanQName & theQName ) const`[pure virtual]`

Determine if an external element is available.

Parameters:

  theQName | The QName of the element

Returns:
  whether the given element is available or not

Reimplemented in StylesheetExecutionContext, StylesheetExecutionContextDefault, and XPathExecutionContextDefault.

virtual void XPathExecutionContext::error ( | const char * msg,
| const XalanNode * sourceNode = 0,
| const LocatorType * locator = 0 ) const`[pure virtual]`

Report an error and throw an exception.

Parameters:

  msg | The text of the message.
  sourceNode | The source node where the error occurred. May be 0.
  locator | A Locator to determine where the error occurred. May be 0.

Reimplemented from ExecutionContext.

Reimplemented in StylesheetExecutionContext, StylesheetExecutionContextDefault, and XPathExecutionContextDefault.

virtual void XPathExecutionContext::error ( | const XalanDOMString & msg,
| const XalanNode * sourceNode = 0,
| const LocatorType * locator = 0 ) const`[pure virtual]`

Report an error and throw an exception.

Parameters:

  msg | The text of the message.
  sourceNode | The source node where the error occurred. May be 0.
  locator | A Locator to determine where the error occurred. May be 0.

Reimplemented from ExecutionContext.

Reimplemented in StylesheetExecutionContext, StylesheetExecutionContextDefault, and XPathExecutionContextDefault.

const XObjectPtr XPathExecutionContext::extFunction ( | const XalanDOMString & theNamespace,
| const XalanDOMString & functionName,
| XalanNode * context,
| const XObjectArgVectorType & argVec,
| const LocatorType * locator )`[pure virtual]`

Handle an extension function.

Parameters:

  theNamespace | namespace of function
  functionName | extension function name
  context | The context node
  argVec | vector of arguments to function
  locator | A LocatorType instance for error reporting

Returns:
  pointer to XObject result

Reimplemented in StylesheetExecutionContext, StylesheetExecutionContextDefault, and XPathExecutionContextDefault.

XalanDOMString XPathExecutionContext::findURIFromDoc ( | const XalanDocument * owner ) const`[pure virtual]`

Given a DOM Document, tell what URI was used to parse it.

Needed for relative resolution.

Parameters:

  owner | source document

Returns:
  document URI

Reimplemented in StylesheetExecutionContext, StylesheetExecutionContextDefault, and XPathExecutionContextDefault.

bool XPathExecutionContext::functionAvailable ( | const XalanDOMString & theName,
| const LocatorType * locator ) const`[pure virtual]`

Determine if a function is available.

Parameters:

  theName | The name of the function
  locator | A LocatorType instance for error reporting

Returns:
  whether the function is available or not

Reimplemented in StylesheetExecutionContext, StylesheetExecutionContextDefault, and XPathExecutionContextDefault.

bool XPathExecutionContext::functionAvailable ( | const XalanQName & theQName ) const`[pure virtual]`

Determine if a function is available.

Parameters:

  theQName | The QName of the function

Returns:
  whether the function is available or not

Reimplemented in StylesheetExecutionContext, StylesheetExecutionContextDefault, and XPathExecutionContextDefault.

XalanDOMString & XPathExecutionContext::getCachedString ( | )`[pure virtual]`

Get a cached string for temporary use.

Returns:
  A reference to the string

Reimplemented in StylesheetExecutionContext, StylesheetExecutionContextDefault, and XPathExecutionContextDefault.

const NodeRefListBase & XPathExecutionContext::getContextNodeList ( | ) const`[pure virtual]`

Retrieve node list for current context.

Returns:
  node list

Reimplemented in StylesheetExecutionContext, StylesheetExecutionContextDefault, and XPathExecutionContextDefault.

virtual size_type XPathExecutionContext::getContextNodeListLength ( | ) const`[pure virtual]`

Reimplemented in StylesheetExecutionContext, StylesheetExecutionContextDefault, and XPathExecutionContextDefault.

virtual size_type XPathExecutionContext::getContextNodeListPosition ( | const XalanNode & contextNode ) const`[pure virtual]`

Reimplemented in StylesheetExecutionContext, StylesheetExecutionContextDefault, and XPathExecutionContextDefault.

XalanNode * XPathExecutionContext::getCurrentNode ( | ) const`[pure virtual]`

Retrieve the node currently being executed.

Returns:
  current node

Reimplemented in StylesheetExecutionContext, StylesheetExecutionContextDefault, and XPathExecutionContextDefault.

const XalanDecimalFormatSymbols * XPathExecutionContext::getDecimalFormatSymbols ( | const XalanQName & qname )`[pure virtual]`

Retrieve the XalanDecimalFormatSymbols instance associated with the name.

Parameters:

  qname | the QName for the lookup

Returns:
  a pointer to the matching instance, or 0 if none was found

Reimplemented in StylesheetExecutionContext, StylesheetExecutionContextDefault, and XPathExecutionContextDefault.

const XalanDOMString * XPathExecutionContext::getNamespaceForPrefix ( | const XalanDOMString & prefix ) const`[pure virtual]`

Retrieve the URI corresponding to a namespace prefix.

Parameters:

  prefix | prefix for a namespace

Returns:
  URI corresponding to namespace

Reimplemented in StylesheetExecutionContext, StylesheetExecutionContextDefault, and XPathExecutionContextDefault.

void XPathExecutionContext::getNodeSetByKey ( | XalanDocument * doc,
| const XalanDOMString & name,
| const XalanDOMString & ref,
| const LocatorType * locator,
| MutableNodeRefList & nodelist )`[pure virtual]`

Given a valid element key, return the corresponding node list.

Parameters:

  doc | source document
  name | name of the key, which must match the 'name' attribute on xsl:key. Will be resolved to a qname using the provided resolver.
  ref | value that must match the value found by the 'match' attribute on xsl:key
  locator | The LocatorType to use for error reporting. Can be 0.
  nodelist | A node list to contain the nodes found

Reimplemented in StylesheetExecutionContext, StylesheetExecutionContextDefault, and XPathExecutionContextDefault.

void XPathExecutionContext::getNodeSetByKey ( | XalanDocument * doc,
| const XalanQName & qname,
| const XalanDOMString & ref,
| MutableNodeRefList & nodelist )`[pure virtual]`

Given a valid element key, return the corresponding node list.

Parameters:

  doc | source document
  name | qname of the key, which must match the 'name' attribute on xsl:key
  ref | value that must match the value found by the 'match' attribute on xsl:key
  nodelist | A node list to contain the nodes found

Reimplemented in StylesheetExecutionContext, StylesheetExecutionContextDefault, and XPathExecutionContextDefault.

const PrefixResolver * XPathExecutionContext::getPrefixResolver ( | ) const`[pure virtual]`

Retrieve the resolver for namespaces.

Returns:
  object for namespace resolution

Reimplemented in StylesheetExecutionContext, StylesheetExecutionContextDefault, and XPathExecutionContextDefault.

virtual XalanDocument* XPathExecutionContext::getSourceDocument ( | const XalanDOMString & theURI ) const`[pure virtual]`

Reimplemented in StylesheetExecutionContext, StylesheetExecutionContextDefault, and XPathExecutionContextDefault.

bool XPathExecutionContext::getThrowFoundIndex ( | ) const`[pure virtual]`

Tells if FoundIndex should be thrown if index is found.

This is an optimization for match patterns, and is used internally by the XPath engine.

Returns:
  true to throw FoundIndex

Reimplemented in StylesheetExecutionContext, StylesheetExecutionContextDefault, and XPathExecutionContextDefault.

const XalanDOMString & XPathExecutionContext::getUnparsedEntityURI ( | const XalanDOMString & theName,
| const XalanDocument & theDocument ) const`[pure virtual]`

The getUnparsedEntityURI function returns the URI of the unparsed entity with the specified name in the same document as the context node (see [3.3 Unparsed Entities]).

It returns the empty string if there is no such entity.

Parameters:

  theName | name of entity
  theDocument | document containing entity

Returns:
  URI for the entity

Reimplemented in StylesheetExecutionContext, StylesheetExecutionContextDefault, and XPathExecutionContextDefault.

const XObjectPtr XPathExecutionContext::getVariable ( | const XalanQName & name,
| const LocatorType * locator = 0 )`[pure virtual]`

Given a name, locate a variable in the current context, and return a pointer to the object.

Parameters:

  theName | name of variable

Returns:
  pointer to an XObject if the variable was found, 0 if it was not

Reimplemented in StylesheetExecutionContext, StylesheetExecutionContextDefault, and XPathExecutionContextDefault.

XObjectFactory & XPathExecutionContext::getXObjectFactory ( | ) const`[]`

Retrieve the factory object for creating XObjects.

Returns:
  factory object instance

bool XPathExecutionContext::isNodeAfter ( | const XalanNode & node1,
| const XalanNode & node2 ) const`[pure virtual]`

Determine if a node is after another node, in document order.

Parameters:

  node1 | The first node
  node2 | The second node

Returns:
  true if node1 one is after node2, or false if it is not.

Reimplemented in StylesheetExecutionContext, StylesheetExecutionContextDefault, and XPathExecutionContextDefault.

virtual void XPathExecutionContext::message ( | const char * msg,
| const XalanNode * sourceNode = 0,
| const LocatorType * locator = 0 ) const`[pure virtual]`

Output a message.

Parameters:

  msg | The text of the message.
  sourceNode | The source node where the message occurred. May be 0.
  locator | A Locator to determine where the message occurred. May be 0.

Reimplemented from ExecutionContext.

Reimplemented in StylesheetExecutionContext, StylesheetExecutionContextDefault, and XPathExecutionContextDefault.

virtual void XPathExecutionContext::message ( | const XalanDOMString & msg,
| const XalanNode * sourceNode = 0,
| const LocatorType * locator = 0 ) const`[pure virtual]`

Output a message.

Parameters:

  msg | The text of the message.
  sourceNode | The source node where the message occurred. May be 0.
  locator | A Locator to determine where the message occurred. May be 0.

Reimplemented from ExecutionContext.

Reimplemented in StylesheetExecutionContext, StylesheetExecutionContextDefault, and XPathExecutionContextDefault.

XalanDocument * XPathExecutionContext::parseXML ( | const XalanDOMString & urlString,
| const XalanDOMString & base ) const`[pure virtual]`

Provides support for XML parsing service.

Parameters:

  urlString | location of the XML
  base | base location for URI

Returns:
  parsed document

Reimplemented in StylesheetExecutionContext, StylesheetExecutionContextDefault, and XPathExecutionContextDefault.

bool XPathExecutionContext::releaseCachedString ( | XalanDOMString & theString )`[pure virtual]`

Return a cached string.

Parameters:

  theString | The string to release.

Returns:
  true if the string was released successfully.

Reimplemented in StylesheetExecutionContext, StylesheetExecutionContextDefault, and XPathExecutionContextDefault.

void XPathExecutionContext::reset ( | )`[pure virtual]`

Reset the instance.

This must be called before another execution is attempted.

Reimplemented in StylesheetExecutionContext, StylesheetExecutionContextDefault, and XPathExecutionContextDefault.

bool XPathExecutionContext::returnMutableNodeRefList ( | MutableNodeRefList * theList )`[pure virtual]`

Return a previously borrowed MutableNodeRefList instance.

Parameters:

  theList | A pointer the to previously borrowed instance.

Returns:
  true if the list was borrowed (at therefore, destroyed), false if not.

Reimplemented in StylesheetExecutionContext, StylesheetExecutionContextDefault, and XPathExecutionContextDefault.

void XPathExecutionContext::setContextNodeList ( | const NodeRefListBase & theList )`[pure virtual]`

Set node list for current context.

Parameters:

  theList | new node list

Reimplemented in StylesheetExecutionContext, StylesheetExecutionContextDefault, and XPathExecutionContextDefault.

void XPathExecutionContext::setCurrentNode ( | XalanNode * theCurrentNode )`[pure virtual]`

Change the node currently being executed.

Parameters:

  theCurrentNode | new current node

Reimplemented in StylesheetExecutionContext, StylesheetExecutionContextDefault, and XPathExecutionContextDefault.

void XPathExecutionContext::setPrefixResolver ( | const PrefixResolver * thePrefixResolver )`[pure virtual]`

Change the resolver for namespaces.

Parameters:

  thePrefixResolver | new object for namespace resolution

Reimplemented in StylesheetExecutionContext, StylesheetExecutionContextDefault, and XPathExecutionContextDefault.

void XPathExecutionContext::setSourceDocument ( | const XalanDOMString & theURI,
| XalanDocument * theDocument )`[pure virtual]`

Associate a document with a given URI.

Parameters:

  theURI | document URI
  theDocument | source document

Reimplemented in StylesheetExecutionContext, StylesheetExecutionContextDefault, and XPathExecutionContextDefault.

void XPathExecutionContext::setThrowFoundIndex ( | bool fThrow )`[pure virtual]`

Changes whether FoundIndex should be thrown if index is found.

This is an optimization for match patterns, and is used internally by the XPath engine.

Parameters:

  fThrow | true to throw FoundIndex

Reimplemented in StylesheetExecutionContext, StylesheetExecutionContextDefault, and XPathExecutionContextDefault.

bool XPathExecutionContext::shouldStripSourceNode ( | const XalanNode & node )`[pure virtual]`

Tells, through the combination of the default-space attribute on xsl:stylesheet, xsl:strip-space, xsl:preserve-space, and the xml:space attribute, whether or not extra whitespace should be stripped from the node.

Literal elements from template elements should not be tested with this function.

Parameters:

  textNode | text node from the source tree

Returns:
  true if the text node should be stripped of extra whitespace

Reimplemented in StylesheetExecutionContext, StylesheetExecutionContextDefault, and XPathExecutionContextDefault.

virtual void XPathExecutionContext::warn ( | const char * msg,
| const XalanNode * sourceNode = 0,
| const LocatorType * locator = 0 ) const`[pure virtual]`

Report a warning.

Parameters:

  msg | The text of the message.
  sourceNode | The source node where the warning occurred. May be 0.
  locator | A Locator to determine where the warning occurred. May be 0.

Reimplemented from ExecutionContext.

Reimplemented in StylesheetExecutionContext, StylesheetExecutionContextDefault, and XPathExecutionContextDefault.

virtual void XPathExecutionContext::warn ( | const XalanDOMString & msg,
| const XalanNode * sourceNode = 0,
| const LocatorType * locator = 0 ) const`[pure virtual]`

Report a warning.

Parameters:

  msg | The text of the message.
  sourceNode | The source node where the warning occurred. May be 0.
  locator | A Locator to determine where the warning occurred. May be 0.

Reimplemented from ExecutionContext.

Reimplemented in StylesheetExecutionContext, StylesheetExecutionContextDefault, and XPathExecutionContextDefault.

## Member Data Documentation

XObjectFactory * XPathExecutionContext::m_xobjectFactory`[protected]`

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

- XPathExecutionContext.hpp

Interpreting class diagrams

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

Xalan-C++ XSLT Processor Version 1.6 Copyright © 2000, 2001, 2002, 2003 The Apache Software Foundation. All Rights Reserved.