Platforms to show: All Mac Windows Linux Cross-Platform

XMLTreeWalkerMBS class

Type Topic Plugin Version macOS Windows Linux iOS Targets
class XML MBS XML Plugin 22.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Allows you to walk over a xml tree.
Example
// walk over all elements of an XML document in document order
Var doc As New XMLDocumentMBS
doc.LoadXml "<library><book><title>Xojo</title></book><book><title>MBS</title></book></library>"

Var walker As XMLTreeWalkerMBS = doc.createTreeWalker(doc.DocumentElement, 1) // 1 = show elements only
Var names() As String
Var node As XMLNodeMBS = walker.CurrentNode
While node <> Nil
names.Add node.NodeName
node = walker.nextNode
Wend
MessageBox String.FromArray(names, " > ")

XMLTreeWalkerMBS objects are used to navigate a document tree or subtree using the view of the document defined by their whatToShow flags and filter (if any). Any function which performs navigation using a XMLTreeWalkerMBS will automatically support any view defined by a XMLTreeWalkerMBS.
Omitting nodes from the logical view of a subtree can result in a structure that is substantially different from the same subtree in the complete, unfiltered document. Nodes that are siblings in the XMLTreeWalkerMBS view may be children of different, widely separated nodes in the original view. For instance, consider a XMLNodeFilterMBS that skips all nodes except for XMLTextMBS nodes and the root node of a document. In the logical view that results, all text nodes will be siblings and appear as direct children of the root node, no matter how deeply nested the structure of the original document.
This is an abstract class. You can't create an instance, but you can get one from various plugin functions.

This class has no subclasses.

Blog Entries

Xojo Developer Magazine

Some methods using this class:

Some related classes:


The items on this page are in the following plugins: MBS XML Plugin.


XMLTextMBS   -   XMLTypeInfoMBS


The biggest plugin in space...