vtkXMLTreeReader

Section: Visualization Toolkit Infovis Classes

Usage

vtkXMLTreeReader parses an XML file and uses the nesting structure of the XML tags to generate a tree. Node attributes are assigned to node arrays, and the special arrays .tagname and .chardata contain the tag type and the text internal to the tag, respectively. The arrays are of type vtkStringArray. There is an array for each attribute type in the XML file, even if it appears in only one tag. If an attribute is missing from a tag, its value is the empty string.

If MaskArrays is on (the default is off), the filter will additionally make bit arrays whose names are prepended with ".valid." which are 1 if the element contains that attribute, and 0 otherwise.

For example, the XML file containing the text: <pre> &lt;node name="jeff" age="26"&gt; this is text in jeff's node &lt;node name="joe"&gt; &lt;node name="al" initials="amb" other="something"/&gt; &lt;node name="dave" age="30"/&gt; &lt;/node&gt; &lt;node name="lisa"&gt;this is text in lisa's node&lt;/node&gt; &lt;node name="darlene" age="29"/&gt; &lt;/node&gt; </pre>

would be parsed into a tree with the following node IDs and structure:

<pre> 0 (jeff) - children: 1 (joe), 4 (lisa), 5 (darlene) 1 (joe) - children: 2 (al), 3 (dave) 2 (al) 3 (dave) 4 (lisa) 5 (darlene) </pre>

and the node data arrays would be as follows:

<pre> name initials other age .tagname .chardata ------------------------------------------------------------------------------------------------ jeff (empty) (empty) 26 node " this is text in jeff's node\n \n \n \n" joe (empty) (empty) (empty) node "\n \n \n " al amb something (empty) node (empty) dave (empty) (empty) 30 node (empty) lisa (empty) (empty) (empty) node "this is text in lisa's node" darlene (empty) (empty) 29 node (empty) </pre>

There would also be the following bit arrays if MaskArrays is on:

<pre> .valid.name .valid.initials .valid.other .valid.age --------------------------------------------------------- 1 0 0 1 1 0 0 0 1 1 1 0 1 0 0 1 1 0 0 0 1 0 0 1 </pre>

To create an instance of class vtkXMLTreeReader, simply invoke its constructor as follows

  obj = vtkXMLTreeReader

Methods

The class vtkXMLTreeReader has several methods that can be used. They are listed below. Note that the documentation is translated automatically from the VTK sources, and may not be completely intelligible. When in doubt, consult the VTK website. In the methods listed below, obj is an instance of the vtkXMLTreeReader class.