But what does this mean in practice?
Here is an example just how simple it can be to generate a hierarchical HTML outline from a graph using InfoGrid’s custom tags:
<dl> <tree:treeIterate startObjectName="Subject" traversalSpecification="xpath:*" meshObjectLoopVar="current"> <tree:down> <dd><dl> </tree:down> <tree:up> </dl></dd> </tree:up> <tree:nodeBefore> <dt> <mesh:meshObject meshObjectName="current"/> </dt> </tree:nodeBefore> </tree:treeIterate> </dl>
The result is a set of nested HTML definition lists, which are a good match for an outline in HTML.
By way of explanation of this example, the outer tag is a big loop, which iterates over all elements in the outline. Every time we walk down the tree, the <tree:down> tag fires and emits the HTML list start element contained there. Every time we walk up the tree, the corresponding <tree:up> tag triggers and closes the list. “Subject” is the name of the start node as JSP bean, and the xpath-like expression is used to describe which branches to traverse in the graph, because it would just as simple traversing the opposite direction, or sideways.
I don’t think it gets much simpler Imagine the pain in SQL, particularly if the tree is deep …