Tree generation

Top  Previous  Next

Examples > XML > Tree generation


nDoc, which just has been shown, is declared in the document production:


{{node nDoc("document");}}


node is a structure, which is characterized by a label (here: "document") and an str-value. In addition nodes have the special property, that they can be combined to trees. Such combinations with other nodes happen in the productions, which are passed while the parsing is done. First nDoc is passed to the production element:


element[ nDoc ]


There another node with the label: "element" is declared:


{{node nElem("element"); }}


which is passed to the content production:




After the content production has been processed nElem is added to xNode (the nDoc passed from document) as a child.




In the same manner meanwhile child nodes are added to the node nElem itself, while the content production was processed. So the whole tree is generated, which then can be shown in the variable inspector.


An alternative inside of the content production is CharData. The token CharData builds a leaf of the tree. Here a node object is created too, but in contrast to the other nodes this node gets a value.


This page belongs to the TextTransformer Documentation

Home  Content  German