Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.10

Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Attributes | Static Protected Attributes | List of all members
XPathExecutionContextDefault Class Reference

A basic implementation of the class XPathExecutionContext. More...

Inheritance diagram for XPathExecutionContextDefault:
XPathExecutionContext ExecutionContext

Classes

struct  ContextNodeListPositionCache

Public Types

typedef XalanVector< XalanNode * > CurrentNodeStackType
typedef XalanVector< const
NodeRefListBase * > 
ContextNodeListStackType
- Public Types inherited from XPathExecutionContext
typedef XalanVector< XObjectPtrXObjectArgVectorType
typedef NodeRefListBase::size_type size_type
typedef GetAndReleaseCachedString GetCachedString

Public Member Functions

 XPathExecutionContextDefault (XPathEnvSupport &theXPathEnvSupport, DOMSupport &theDOMSupport, XObjectFactory &theXObjectFactory, XalanNode *theCurrentNode=0, const NodeRefListBase *theContextNodeList=0, const PrefixResolver *thePrefixResolver=0)
 Construct an XPathExecutionContextDefault object.
 XPathExecutionContextDefault (MemoryManagerType &theManager, XalanNode *theCurrentNode=0, const NodeRefListBase *theContextNodeList=0, const PrefixResolver *thePrefixResolver=0)
 Construct an XPathExecutionContextDefault object.
virtual ~XPathExecutionContextDefault ()
XPathEnvSupportgetXPathEnvSupport () const
 Get the XPathEnvSupport instance.
void setXPathEnvSupport (XPathEnvSupport *theSupport)
 Set the XPathEnvSupport instance.
void setDOMSupport (DOMSupport *theDOMSupport)
 Set the DOMSupport instance.
void setXObjectFactory (XObjectFactory *theXObjectFactory)
 Set the XObjectFactory instance.
XalanQNameByValuegetScratchQName () const
 Get a reference to the scratch QNameByValue instance.
virtual void doFormatNumber (double number, const XalanDOMString &pattern, const XalanDecimalFormatSymbols *theDFS, XalanDOMString &theResult, const XalanNode *context=0, const LocatorType *locator=0)
virtual void reset ()
 Reset the instance.
virtual XalanNodegetCurrentNode () const
 Retrieve the node currently being executed.
virtual void pushCurrentNode (XalanNode *theCurrentNode)
 Change the node currently being executed.
virtual void popCurrentNode ()
 Reset the node currently being executed.
virtual bool isNodeAfter (const XalanNode &node1, const XalanNode &node2) const
 Determine if a node is after another node, in document order.
virtual void pushContextNodeList (const NodeRefListBase &theList)
 Push the node list for current context.
virtual void popContextNodeList ()
 Pop the node list for current context.
virtual const NodeRefListBasegetContextNodeList () const
 Get the node list for current context.
virtual size_type getContextNodeListLength () const
virtual size_type getContextNodeListPosition (const XalanNode &contextNode) const
virtual bool elementAvailable (const XalanQName &theQName) const
 Determine if an external element is available.
virtual bool elementAvailable (const XalanDOMString &theName, const LocatorType *locator) const
 Determine if an external element is available by resolving a string to a QName.
virtual bool functionAvailable (const XalanQName &theQName) const
 Determine if a function is available.
virtual bool functionAvailable (const XalanDOMString &theName, const LocatorType *locator) const
 Determine if a function is available.
virtual const XObjectPtr extFunction (const XalanDOMString &theNamespace, const XalanDOMString &functionName, XalanNode *context, const XObjectArgVectorType &argVec, const LocatorType *locator)
 Handle an extension function.
virtual XalanDocumentparseXML (MemoryManagerType &theManager, const XalanDOMString &urlString, const XalanDOMString &base) const
 Provides support for XML parsing service.
virtual MutableNodeRefListborrowMutableNodeRefList ()
 Borrow a cached MutableNodeRefList instance.
virtual bool returnMutableNodeRefList (MutableNodeRefList *theList)
 Return a previously borrowed MutableNodeRefList instance.
virtual MutableNodeRefListcreateMutableNodeRefList (MemoryManagerType &theManager) const
 Create a MutableNodeRefList with the appropriate context.
virtual XalanDOMStringgetCachedString ()
 Get a cached string for temporary use.
virtual bool releaseCachedString (XalanDOMString &theString)
 Return a cached string.
virtual void getNodeSetByKey (XalanDocument *doc, const XalanQName &qname, const XalanDOMString &ref, MutableNodeRefList &nodelist)
 Given a valid element key, return the corresponding node list.
virtual void getNodeSetByKey (XalanDocument *doc, const XalanDOMString &name, const XalanDOMString &ref, const LocatorType *locator, MutableNodeRefList &nodelist)
 Given a valid element key, return the corresponding node list.
virtual const XObjectPtr getVariable (const XalanQName &name, const LocatorType *locator=0)
 Given a name, locate a variable in the current context, and return a pointer to the object.
virtual const PrefixResolvergetPrefixResolver () const
 Retrieve the resolver for namespaces.
virtual void setPrefixResolver (const PrefixResolver *thePrefixResolver)
 Change the resolver for namespaces.
virtual const XalanDOMStringgetNamespaceForPrefix (const XalanDOMString &prefix) const
 Retrieve the URI corresponding to a namespace prefix.
virtual const XalanDOMStringfindURIFromDoc (const XalanDocument *owner) const
 Given a DOM Document, tell what URI was used to parse it.
virtual const XalanDOMStringgetUnparsedEntityURI (const XalanDOMString &theName, const XalanDocument &theDocument) const
 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]).
virtual bool shouldStripSourceNode (const XalanText &node)
 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.
virtual XalanDocumentgetSourceDocument (const XalanDOMString &theURI) const
 Get the document associated with the given URI.
virtual void setSourceDocument (const XalanDOMString &theURI, XalanDocument *theDocument)
 Associate a document with a given URI.
virtual void formatNumber (double number, const XalanDOMString &pattern, XalanDOMString &theResult, const XalanNode *context=0, const LocatorType *locator=0)
 Formats a number according to the specified pattern.
virtual void formatNumber (double number, const XalanDOMString &pattern, const XalanDOMString &dfsName, XalanDOMString &theResult, const XalanNode *context=0, const LocatorType *locator=0)
 Formats a number according to the specified pattern.
virtual void error (const XalanDOMString &msg, const XalanNode *sourceNode=0, const LocatorType *locator=0) const
 Report an error and throw an exception.
virtual void warn (const XalanDOMString &msg, const XalanNode *sourceNode=0, const LocatorType *locator=0) const
 Report a warning.
virtual void message (const XalanDOMString &msg, const XalanNode *sourceNode=0, const LocatorType *locator=0) const
 Output a message.
- Public Member Functions inherited from XPathExecutionContext
 XPathExecutionContext (MemoryManagerType &m_memoryManager, XObjectFactory *theXObjectFactory=0)
virtual ~XPathExecutionContext ()
XObjectFactorygetXObjectFactory () const
 Retrieve the factory object for creating XObjects.
- Public Member Functions inherited from ExecutionContext
 ExecutionContext (MemoryManagerType &m_memoryManager)
virtual ~ExecutionContext ()
MemoryManagerTypegetMemoryManager ()

Static Public Member Functions

static
XPathExecutionContextDefault
create (MemoryManagerType &theManager, XalanNode *theCurrentNode=0, const NodeRefListBase *theContextNodeList=0, const PrefixResolver *thePrefixResolver=0)

Protected Types

enum  { eNodeListCacheListSize = 50 }
typedef XalanObjectCache
< MutableNodeRefList,
DefaultCacheCreateFunctorMemMgr
< MutableNodeRefList >
, DeleteFunctor
< MutableNodeRefList >
, ClearCacheResetFunctor
< MutableNodeRefList > > 
NodeListCacheType

Protected Attributes

XPathEnvSupportm_xpathEnvSupport
DOMSupportm_domSupport
CurrentNodeStackType m_currentNodeStack
ContextNodeListStackType m_contextNodeListStack
const PrefixResolverm_prefixResolver
XalanDOMString m_currentPattern
NodeListCacheType m_nodeListCache
XalanDOMStringCache m_stringCache
ContextNodeListPositionCache m_cachedPosition
XalanQNameByValue m_scratchQName
- Protected Attributes inherited from XPathExecutionContext
XObjectFactorym_xobjectFactory
- Protected Attributes inherited from ExecutionContext
MemoryManagerTypem_memoryManager

Static Protected Attributes

static const NodeRefList s_dummyList

Detailed Description

A basic implementation of the class XPathExecutionContext.

Member Typedef Documentation

Member Enumeration Documentation

anonymous enum
protected
Enumerator:
eNodeListCacheListSize 

Constructor & Destructor Documentation

XPathExecutionContextDefault::XPathExecutionContextDefault ( XPathEnvSupport theXPathEnvSupport,
DOMSupport theDOMSupport,
XObjectFactory theXObjectFactory,
XalanNode theCurrentNode = 0,
const NodeRefListBase theContextNodeList = 0,
const PrefixResolver thePrefixResolver = 0 
)

Construct an XPathExecutionContextDefault object.

Parameters
theXPathEnvSupportXPathEnvSupport class instance
theDOMSupportDOMSupport class instance
theXobjectFactoryfactory class instance for XObjects
theCurrentNodecurrent node in the source tree
theContextNodeListnode list for current context
thePrefixResolverpointer to prefix resolver to use
XPathExecutionContextDefault::XPathExecutionContextDefault ( MemoryManagerType theManager,
XalanNode theCurrentNode = 0,
const NodeRefListBase theContextNodeList = 0,
const PrefixResolver thePrefixResolver = 0 
)
explicit

Construct an XPathExecutionContextDefault object.

Parameters
theXPathEnvSupportXPathEnvSupport class instance
theXObjectFactoryfactory class instance for XObjects
theCurrentNodecurrent node in the source tree
theContextNodeListnode list for current context
thePrefixResolverpointer to prefix resolver to use
virtual XPathExecutionContextDefault::~XPathExecutionContextDefault ( )
virtual

Member Function Documentation

virtual MutableNodeRefList* XPathExecutionContextDefault::borrowMutableNodeRefList ( )
virtual

Borrow a cached MutableNodeRefList instance.

Returns
A pointer to the instance.

Implements XPathExecutionContext.

static XPathExecutionContextDefault* XPathExecutionContextDefault::create ( MemoryManagerType theManager,
XalanNode theCurrentNode = 0,
const NodeRefListBase theContextNodeList = 0,
const PrefixResolver thePrefixResolver = 0 
)
static
virtual MutableNodeRefList* XPathExecutionContextDefault::createMutableNodeRefList ( MemoryManagerType theManager) const
virtual

Create a MutableNodeRefList with the appropriate context.

Returns
pointer to node list created

Implements XPathExecutionContext.

virtual void XPathExecutionContextDefault::doFormatNumber ( double  number,
const XalanDOMString pattern,
const XalanDecimalFormatSymbols theDFS,
XalanDOMString theResult,
const XalanNode context = 0,
const LocatorType locator = 0 
)
virtual
virtual bool XPathExecutionContextDefault::elementAvailable ( const XalanQName theQName) const
virtual

Determine if an external element is available.

Parameters
theQNameThe QName of the element
Returns
whether the given element is available or not

Implements XPathExecutionContext.

virtual bool XPathExecutionContextDefault::elementAvailable ( const XalanDOMString theName,
const LocatorType locator 
) const
virtual

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

Parameters
theNameThe name of the element
locatorA LocatorType instance for error reporting
Returns
whether the given element is available or not

Implements XPathExecutionContext.

virtual void XPathExecutionContextDefault::error ( const XalanDOMString msg,
const XalanNode sourceNode = 0,
const LocatorType locator = 0 
) const
virtual

Report an error and throw an exception.

Parameters
msgThe text of the message.
sourceNodeThe source node where the error occurred. May be 0.
locatorA Locator to determine where the error occurred. May be 0.

Implements XPathExecutionContext.

virtual const XObjectPtr XPathExecutionContextDefault::extFunction ( const XalanDOMString theNamespace,
const XalanDOMString functionName,
XalanNode context,
const XObjectArgVectorType argVec,
const LocatorType locator 
)
virtual

Handle an extension function.

Parameters
theNamespacenamespace of function
functionNameextension function name
contextThe context node
argVecvector of arguments to function
locatorA LocatorType instance for error reporting
Returns
pointer to XObject result

Implements XPathExecutionContext.

virtual const XalanDOMString& XPathExecutionContextDefault::findURIFromDoc ( const XalanDocument owner) const
virtual

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

Needed for relative resolution.

Parameters
ownersource document
Returns
document URI

Implements XPathExecutionContext.

virtual void XPathExecutionContextDefault::formatNumber ( double  number,
const XalanDOMString pattern,
XalanDOMString theResult,
const XalanNode context = 0,
const LocatorType locator = 0 
)
virtual

Formats a number according to the specified pattern.

Parameters
numberthe number to be formatted
patternthe format pattern
theResultthe formatted number
contextthe source node
locatorthe locator

Implements XPathExecutionContext.

virtual void XPathExecutionContextDefault::formatNumber ( double  number,
const XalanDOMString pattern,
const XalanDOMString dfsName,
XalanDOMString theResult,
const XalanNode context = 0,
const LocatorType locator = 0 
)
virtual

Formats a number according to the specified pattern.

Parameters
numberthe number to be formatted
patternthe format pattern
dfsNamethe name of decimal format to use
theResultthe formatted number
contextthe source node
locatorthe locator
Returns
a pointer to the functor, 0 if none was found

Implements XPathExecutionContext.

virtual bool XPathExecutionContextDefault::functionAvailable ( const XalanQName theQName) const
virtual

Determine if a function is available.

Parameters
theQNameThe QName of the function
Returns
whether the function is available or not

Implements XPathExecutionContext.

virtual bool XPathExecutionContextDefault::functionAvailable ( const XalanDOMString theName,
const LocatorType locator 
) const
virtual

Determine if a function is available.

Parameters
theNameThe name of the function
locatorA LocatorType instance for error reporting
Returns
whether the function is available or not

Implements XPathExecutionContext.

virtual XalanDOMString& XPathExecutionContextDefault::getCachedString ( )
virtual

Get a cached string for temporary use.

Returns
A reference to the string

Implements XPathExecutionContext.

virtual const NodeRefListBase& XPathExecutionContextDefault::getContextNodeList ( ) const
virtual

Get the node list for current context.

Returns
node list

Implements XPathExecutionContext.

virtual size_type XPathExecutionContextDefault::getContextNodeListLength ( ) const
virtual

Implements XPathExecutionContext.

virtual size_type XPathExecutionContextDefault::getContextNodeListPosition ( const XalanNode contextNode) const
virtual

Implements XPathExecutionContext.

virtual XalanNode* XPathExecutionContextDefault::getCurrentNode ( ) const
virtual

Retrieve the node currently being executed.

Returns
current node

Implements XPathExecutionContext.

virtual const XalanDOMString* XPathExecutionContextDefault::getNamespaceForPrefix ( const XalanDOMString prefix) const
virtual

Retrieve the URI corresponding to a namespace prefix.

Parameters
prefixprefix for a namespace
Returns
URI corresponding to namespace

Implements XPathExecutionContext.

virtual void XPathExecutionContextDefault::getNodeSetByKey ( XalanDocument doc,
const XalanQName qname,
const XalanDOMString ref,
MutableNodeRefList nodelist 
)
virtual

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

Parameters
docsource document
nameqname of the key, which must match the 'name' attribute on xsl:key
refvalue that must match the value found by the 'match' attribute on xsl:key
nodelistA node list to contain the nodes found

Implements XPathExecutionContext.

virtual void XPathExecutionContextDefault::getNodeSetByKey ( XalanDocument doc,
const XalanDOMString name,
const XalanDOMString ref,
const LocatorType locator,
MutableNodeRefList nodelist 
)
virtual

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

Parameters
docsource document
namename of the key, which must match the 'name' attribute on xsl:key. Will be resolved to a qname using the provided resolver.
refvalue that must match the value found by the 'match' attribute on xsl:key
locatorThe LocatorType to use for error reporting. Can be 0.
nodelistA node list to contain the nodes found

Implements XPathExecutionContext.

virtual const PrefixResolver* XPathExecutionContextDefault::getPrefixResolver ( ) const
virtual

Retrieve the resolver for namespaces.

Returns
object for namespace resolution

Implements XPathExecutionContext.

XalanQNameByValue& XPathExecutionContextDefault::getScratchQName ( ) const

Get a reference to the scratch QNameByValue instance.

Returns
A reference to a QNameByValue instance.
virtual XalanDocument* XPathExecutionContextDefault::getSourceDocument ( const XalanDOMString theURI) const
virtual

Get the document associated with the given URI.

Parameters
theURIdocument URI
Returns
a pointer to the document instance, if any.

Implements XPathExecutionContext.

virtual const XalanDOMString& XPathExecutionContextDefault::getUnparsedEntityURI ( const XalanDOMString theName,
const XalanDocument theDocument 
) const
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
theNamename of entity
theDocumentdocument containing entity
Returns
URI for the entity

Implements XPathExecutionContext.

virtual const XObjectPtr XPathExecutionContextDefault::getVariable ( const XalanQName name,
const LocatorType locator = 0 
)
virtual

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

Parameters
theNamename of variable
Returns
An XObjectPtr instance. If the variable is not found, an exception is thrown, or the routine returns an instance of XUnknown.

Implements XPathExecutionContext.

XPathEnvSupport* XPathExecutionContextDefault::getXPathEnvSupport ( ) const

Get the XPathEnvSupport instance.

Returns
a pointer to the instance.
virtual bool XPathExecutionContextDefault::isNodeAfter ( const XalanNode node1,
const XalanNode node2 
) const
virtual

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

Parameters
node1The first node
node2The second node
Returns
true if node1 one is after node2, or false if it is not.

Implements XPathExecutionContext.

virtual void XPathExecutionContextDefault::message ( const XalanDOMString msg,
const XalanNode sourceNode = 0,
const LocatorType locator = 0 
) const
virtual

Output a message.

Parameters
msgThe text of the message.
sourceNodeThe source node where the message occurred. May be 0.
locatorA Locator to determine where the message occurred. May be 0.

Implements XPathExecutionContext.

virtual XalanDocument* XPathExecutionContextDefault::parseXML ( MemoryManagerType theManager,
const XalanDOMString urlString,
const XalanDOMString base 
) const
virtual

Provides support for XML parsing service.

Parameters
urlStringlocation of the XML
basebase location for URI
Returns
parsed document

Implements XPathExecutionContext.

virtual void XPathExecutionContextDefault::popContextNodeList ( )
virtual

Pop the node list for current context.

Implements XPathExecutionContext.

virtual void XPathExecutionContextDefault::popCurrentNode ( )
virtual

Reset the node currently being executed.

Implements XPathExecutionContext.

virtual void XPathExecutionContextDefault::pushContextNodeList ( const NodeRefListBase theList)
virtual

Push the node list for current context.

Parameters
theListnew node list

Implements XPathExecutionContext.

virtual void XPathExecutionContextDefault::pushCurrentNode ( XalanNode theCurrentNode)
virtual

Change the node currently being executed.

Parameters
theCurrentNodenew current node

Implements XPathExecutionContext.

virtual bool XPathExecutionContextDefault::releaseCachedString ( XalanDOMString theString)
virtual

Return a cached string.

Parameters
theStringThe string to release.
Returns
true if the string was released successfully.

Implements XPathExecutionContext.

virtual void XPathExecutionContextDefault::reset ( )
virtual

Reset the instance.

This must be called before another execution is attempted.

Implements XPathExecutionContext.

virtual bool XPathExecutionContextDefault::returnMutableNodeRefList ( MutableNodeRefList theList)
virtual

Return a previously borrowed MutableNodeRefList instance.

Parameters
theListA pointer the to previously borrowed instance.
Returns
true if the list was borrowed (at therefore, destroyed), false if not.

Implements XPathExecutionContext.

void XPathExecutionContextDefault::setDOMSupport ( DOMSupport theDOMSupport)

Set the DOMSupport instance.

Parameters
theDOMSupporta reference to the instance to use.
virtual void XPathExecutionContextDefault::setPrefixResolver ( const PrefixResolver thePrefixResolver)
virtual

Change the resolver for namespaces.

Parameters
thePrefixResolvernew object for namespace resolution

Implements XPathExecutionContext.

virtual void XPathExecutionContextDefault::setSourceDocument ( const XalanDOMString theURI,
XalanDocument theDocument 
)
virtual

Associate a document with a given URI.

Parameters
theURIdocument URI
theDocumentsource document

Implements XPathExecutionContext.

void XPathExecutionContextDefault::setXObjectFactory ( XObjectFactory theXObjectFactory)

Set the XObjectFactory instance.

Parameters
theFactorya reference to the instance to use.
void XPathExecutionContextDefault::setXPathEnvSupport ( XPathEnvSupport theSupport)

Set the XPathEnvSupport instance.

Parameters
theSupporta reference to the instance to use.
virtual bool XPathExecutionContextDefault::shouldStripSourceNode ( const XalanText node)
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
textNodetext node from the source tree
Returns
true if the text node should be stripped of extra whitespace

Implements XPathExecutionContext.

virtual void XPathExecutionContextDefault::warn ( const XalanDOMString msg,
const XalanNode sourceNode = 0,
const LocatorType locator = 0 
) const
virtual

Report a warning.

Parameters
msgThe text of the message.
sourceNodeThe source node where the warning occurred. May be 0.
locatorA Locator to determine where the warning occurred. May be 0.

Implements XPathExecutionContext.

Member Data Documentation

ContextNodeListPositionCache XPathExecutionContextDefault::m_cachedPosition
mutableprotected
ContextNodeListStackType XPathExecutionContextDefault::m_contextNodeListStack
protected
CurrentNodeStackType XPathExecutionContextDefault::m_currentNodeStack
protected
XalanDOMString XPathExecutionContextDefault::m_currentPattern
protected
DOMSupport* XPathExecutionContextDefault::m_domSupport
protected
NodeListCacheType XPathExecutionContextDefault::m_nodeListCache
protected
const PrefixResolver* XPathExecutionContextDefault::m_prefixResolver
protected
XalanQNameByValue XPathExecutionContextDefault::m_scratchQName
mutableprotected
XalanDOMStringCache XPathExecutionContextDefault::m_stringCache
protected
XPathEnvSupport* XPathExecutionContextDefault::m_xpathEnvSupport
protected
const NodeRefList XPathExecutionContextDefault::s_dummyList
staticprotected

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.

dot

Xalan-C++ XSLT Processor Version 1.10
Copyright © 1999-2004 The Apache Software Foundation. All Rights Reserved.

Apache Logo