Tinderbox v10 Icon

XML.xml(pathStr)


Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Data Type Returned: 

Operator First Added: 

Operator in Current Baseline: 

Operator Last Altered: 

 Function  [other Function type actions]

 Item  [operators of similar scope]

 Stream parsing  [other Stream parsing operators]

 source context dependent

 v9.1.0

 Baseline

 As at baseline


XML.xml(pathStr)

If there is no current XML object, attempts to parse the string as XML and fails if unsuccessful. If there is a current XML object, it will be reused.

Returns a specific piece of data from the XML object, determined by the pathStr should be an expression or a quoted string.

Consider a note "Source note" with this $Text:

<shelf>
	<book price="9.95">War and Peace</book>
	<book price="4.95">No et Moi</book>
	<audio price="14.95">Born To Run</audio>
</shelf>

Example usage of path:

$Text("test") = $Text("Source note").xml("/shelf/book"); 

sets $Text of note "test" to a list of children of the <shelf> element that are <book> elements. "War and Peace;No et Moi"

$Text("test") = $Text("Source note").$Text.xml("/shelf/book[2]") 

sets $Text of note "test" to the value of child element of the <shelf> element that represents the second book, "No et Moi". See 'Notes' below.

$Text("test") = $Text("Source note").$Text.xml("/shelf/book@price") 

sets $Text of note "test" to the price attribute of each book, "9.954.95"

Notes:


See also—notes linking to here: