Ken Webb 2010-05-10T12:52:54Z
Any XML structure must be a tree. A tree, by definition, has a single root node. XML parsers will throw an exception if they are given XML content that has more than one root element. For example, the following is a tree:
<HelloWorldSystem> <Hello/> <World/> </HelloWorldSystem>
Internally, Xholon stores all nodes in a tree structure. It would represent the above XML using three Xholon/Java objects, an instance of HelloWorldSystem with a Hello child and a World child.
When a Xholon application is running, it's always possible to inject new content in the form of XML Strings. There's a problem when the new content is just a sequence of sibling nodes with no single root. For example, if you wanted to add a new Hello and World node to HelloWorldSystem, you could NOT just paste in:
<Hello/> <World/>
This is called a forest. There is more than one root node.
To get around this problem, Xholon supports a special notation to specify that XML elements are part of a forest. The following XML can be pasted into the HelloWorldSystem Xholon node.
<_-.forest> <Hello/> <World/> </_-.forest>
Once this is done, the Xholon composite structure tree would be:
HelloWorldSystem Hello World Hello World
Any XML element that begins with <_-. is parsed normally by the XML parser, and is then treated specially by the Xholon XML reader. The <_-. element is discarded, and only the elements it contains are added to the Xholon tree.
The forest notation can also be used to paste in an XML xi:include element. For example:
<_-.forest> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="./config/user/MeTTTa/ScoreMVC.xml"/> </_-.forest>
The element name for a forest can contain any valid text as long as the name begins with the _-. characters. The following is a valid forest.
<_-.ThisElementWillBeDiscarded> <X/> <Y/> </_-.ThisElementWillBeDiscarded>