MagicTree supports different sorts of nodes that can be used to represent various kinds of objects and data.
Branch Nodes
Two Branch nodes
A branch node contains one string value, for example "magictree". The value of the branch node is represented as tag name in XML, so there are certain limitations on what characters the branch node value can contain. For example, they cannot contain spaces. Branch nodes are generally used in MagicTree to create tree structure. For example, the MagicTree root node and the nodes for test data, repository and tasks are all branch nodes. Branch nodes are not very usefull for storing actuall data due to the limitations on their values.
Branch nodes are represented by MrBranchObject class.
In XML a branch node with value "nodevalue" is represented as follows:
<nodevalue id="999" status="none" class="MtBranchObject" />
When branch nodes are compared for equality during merge only the node values are compared. Two branch nodes are equal if their values are equal.
Branch nodes, when represented in XML, should not have any text. If a branch node is read from XML representation any text is ignored by MagicTree.
Simple Nodes
Simple nodes are the most commonly used for storing actual data. A simple node representa a name-value pair. Simple nodes are used, for example, to represent hosts, ports, services, etc.
The host is represented by a Simple node (with type "host" and name "127.0.0.1")
Simple nodes are represented by MtSimpleObject class.
In XML a simple node is represented as follows:
<host id="999" status="none">127.0.0.1</host>
Simple nodes represented in XML may have "class" attribute with value set to "MtSimpleObject". If an XML element does not have a "class" attribute, it is treated as simple node.
When simple nodes are loaded from XML the text data is trimmed (the whitespace in the beginning and the end of the text is removed). When simple nodes are compared for equality during merge, the types and the names of the nodes are compared. Two simple ndoes are equal if they have the same type and the same name. Names are trimmed of whitespace.
Text Nodes
Text nodes are useful for representing longer textual data that does not fit nicely in simple nodes. A text node has a title and a text. Currently text nodes do not support formatted text. Both the title and the text can contain arbitrary characters.
A text node in the tree on the left and its text content in the tab on the right
Text nodes are represented by MtTextObject class.
In XML a text node is represented as follows:
<text id="999" status="none" class="MtTextNode" title="Executive Summary">This report is about something.</text>
Text nodes always have "text" as their XML tag. The "title" attribute is used to store the title.
When compared for equality during merge, only titles are compared, not the text. If the two text objects have the same title, but different text, the merged object has the text of the object in the merging tree.
Data Nodes
Data nodes are used for storing arbitrary (possibly large) data. Two specialized kinds of data nodes - Image nodes and XML Data nodes are used for storing and displaying images and XML data respectively.
Data nodes look like this in the tree:
Data node
Currently MagicTree GUI does not provide a way to attach a file to data node.
Data nodes are represented by MtDataObject class.
In XML a data node is represented as follows:
<data id="999" status="none" class="MtDataObject" filename="packetdump.bin">Packet dump</data>
The actual data is stored outside of the XML file in a subdirectory inside the project file (see Project File Structure)
During merge data objects are compared based on their titles and data. If two data objects have equal titles and bit-by-bit equal data files, they are considered equal.
XML Data Nodes
XML Data nodes are similar to generic data nodes, except that the attached file contains XML data in a format understood by MagicTree. XML Data nodes are most commonly used to store the output of tasks that generate XML. The XML data stored in an XML Data node may be merged into the tree.
XML data nodes are represented by MtXmlDataObject class.
Image Nodes
Image nodes are similar to generic Data nodes except that the attahed file contains an image. Images from Image nodes may be easily included in generated reports. Image nodes are intended for storing screenshots and other image data that is somehow relevant to the current project.
A image node in the tree on the left and its content in the tab on the right
Cross-References
Cross-references are a special kind of node. Cross-reference node points to another node in the tree. Cross-references are useful for linking one branch of the tree with some other branch. For example, you may want to list affected hosts under some finding node in the "report" branch. Instead of creating a new node for each affected host under the "finding" node, you can create cross-references and and point them to the host nodes under the "testdata" branch.
Cross-reference pointing to a host node
Cross-references can not have child nodes.
To link a cross-reference to a node, right click on the cross-reference node, select "Link to object" from the context menu and then select the object you want to link the cross-reference to. To follow a cross-reference Ctrl+click it.
Cross-references are represented by MtXrefObject class.
In XML data a cross-reference is represented as follows:
<xref id="7" status="none" class="MtXrefObject" href="#2"/>
The "xref" attribute contains the id of the node that the cross-reference links to.
During merge, cross-references are compared based on the objects they point to. For two cross-references to be equal, the objects they point to have to be equal and all ancestors of the nodes they point to up to the tree root have to be equal. The reason behind it is that a cross-reference pointing to port 80 of host 127.0.0.1 is not the same a cross-reference pointing to port 80 of host 192.168.1.1. Therefore to establish the equality, we have to compare all ancestor nodes as well.
Issue Nodes (Should we call them summary nodes?)
XXX
Special Kinds of Nodes
MagicTree creates tree nodes for queries, methods and tasks. They are created automatically as necessary when a task is executed. These nodes can not be created manually and normally there is no need to do that. Queries and methods are stored in the "repo" branch. Tasks are stored in the "tasks" branch:
Queries, Methods and Tasks