revXMLTree

Typefunction
DictionaryLCS
LibraryLiveCode Script
Syntax
revXMLTree(<treeID>, <startNode>, <nodeDelim>, <padding>, <includeChildCount>, <depth>)
Associationsxml library
Summary

Returns a list of the nodes in an XML tree, in a form that shows their parent/child relationships.

Introduced2.0
OSmac, windows, linux, ios, android
Platformsdesktop, server, mobile
Parameters
NameTypeDescription
treeID

The number returned by the revXMLCreateTree or revXMLCreateTreeFromFile function when you created the XML tree.

startNode

The path to the node where you want to start.

nodeDelim

A string that separates each node's name from the rest.

padding

A string that is placed before the name of each node to show its depth in the tree. No padding is placed before the startNode's name.

includeChildCount

If the includeChildCount is true, each node's name is followed by the node's positional predicate, ie which child number the node is.

depth

The depth specifies how many generations of the XML tree to show. If you specify zero, only the startNode is shown; if you specify 1, the startNode and its child nodes are shown, but not their child nodes; and so on. To show all generations, specify -1 as the depth.

Example
revXMLTree(3,"/Sound",return,space,false,1)
revXMLTree(currTree,foundNode,space,,true,2)
put revXMLTree(myTree,theNode,return,tab,false,-1) into field "Node List"
Values
NameTypeDescription
return

The revXMLTree function returns a string.

The result

Typically, you use return as the nodeDelimiter and tab as the padding. The resulting list of nodes is displayed one node per line, with as many leading tabs as the node's depth.

RelatedProperty: nodes
Library: XML library
Keyword: string
Constant: tab
Function: revXMLText, revXMLMatchingNode
Control Structure: function
Glossary: LiveCode custom library, Standalone Application Settings, node, standalone application, XML tree, return
Securitydisk
Description

Use the revXMLTree function to obtain a text "tree-style" view of an XML tree's nodes.

To display the entire XML tree, specify the root node returned by the revXMLRootNode function as the startNode.

If the revXMLTree function encounters an error, it returns an error message starting with "xmlerr".

Important: The revXMLTree function is part of the XML library. To ensure that the function works in a standalone application, you must include this custom library when you create your standalone. In the Inclusions pane of the Standalone Application Settings window, make sure the "XML" checkbox is checked.

Tagstext processing