class %XML.XPATH.Document
extends %RegisteredObject
Implements an interface to the XPATH Document. XML contained in a file or binary stream
may be selected and navigated. %XML.XPATH.Document should never be created directly with
%New(), but via the CreateFromFile() or CreateFromStream() factory methods
property PrefixMappings
as %String;
This holds a string specifying prefix mappings for the document. This is a comma delimited list
of prefix to namespace mappings. Each mapping is defined as a prefix, a space and then the uri to
which that prefix maps. This is especially useful if the document defines a default namespace with the
xmlns="http://somenamespaceuri" syntax but does not supply an explicit prefix mapping. For example, this
PrefixMappings string would map the myprefix prefix to the http://somenamespaceuri uri.
"myprefix http://somenamespaceuri
property ResultHandler
as %XML.XPATH.ResultHandler;
This holds the default ResultHandler
classmethod CreateFromFile(pSource As %String, Output pDocument As %XML.XPATH.Document, pResolver As %XML.SAX.EntityResolver = $$$NULLOREF, pErrorHandler As %XML.XSLT.ErrorHandler = $$$NULLOREF, pFlags As %Integer = 0, pSchemaSpec As %String = "", pPrefixMappings As %String = "")
as %Status
Use this method a create an instance of an %XML.XPATH.Document from a file path name.
classmethod CreateFromStream(pStream As %AbstractStream, Output pDocument As %XML.XPATH.Document, pResolver As %XML.SAX.EntityResolver = $$$NULLOREF, pErrorHandler As %XML.XSLT.ErrorHandler = $$$NULLOREF, pFlags As %Integer = 0, pSchemaSpec As %String = "", pPrefixMappings As %String = "")
as %Status
Use this method to create an instance of an %XML.XPATH.Document from a binary stream
classmethod CreateFromString(pString As %String, Output pDocument As %XML.XPATH.Document, pResolver As %XML.SAX.EntityResolver = $$$NULLOREF, pErrorHandler As %XML.XSLT.ErrorHandler = $$$NULLOREF, pFlags As %Integer = 0, pSchemaSpec As %String = "", pPrefixMappings As %String = "")
as %Status
Use this method to create an instance of a %XML.XPATH.Document from a string
method EvaluateExpression(pContext As %String, pExpression As %String, Output pResults As %ListOfObjects(CLASSNAME="%XML.XPATH.RESULT"))
as %Status
This method evaluates an XPATH context and expression. The context selects the intial nodeset from the document and
the expression further filters the node set. See http://www.w3.org/TR/xpath for full details of XPATH syntax and usage
If the method succeeds it returns a list of Results which can be queried for their types and values.
classmethod Example1()
Evaluates an XPATH expression which returns a DOM Result
classmethod Example2()
Evaluates an XPATH expression which returns a VALUE Result
classmethod Example3()
Evaluates an XPATH expression which returns a VALUE Result ( demonstrates use of CreateFromString() )
classmethod ExampleDisplayResults(pResults As %ListOfObjects(CLASSNAME="%XML.XPATH.Result"))