Reference Guide > X–Z Routines > XmlSetContext Function
  

XmlSetContext Function
Sets the start location or the context of the parsed document. All subsequent searches performed with XmlEvaluate will only be performed on the document tree under this starting location.
Usage
context_id = XmlSetContext(document_id)
Input Parameters
document_id—A handle returned by XmlParse or XmlNewDoc which identifies the DOM representation for an XML source.
Returned Value
context_id—The new context ID for this location. By default the context ID is set to the root location. If the function fails or if no data is available, –1 is returned. This ID is used as input in XmlEvaluate using the context_id keyword.
Keywords
path—A string representing the new starting location. The XML path is similar to a directory/file path in that it is a slash separated set of node names.
Discussion
Sets the start location of the document tree to the path provided or to the default location (root node of the document). Queries with XmlEvaluate can be performed according to this context if the context_id is specified. If you want to only query a sub tree of the document tree then you can use this function to change to the sub tree node.
Example
This example sets the Document root to ChartTitle.
; Change the start location.
context_id = XmlSetContext(doc_id, Path='/Chart/Chartitle')

Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.