This sample app demonstrates how you can use the org.apache.pivot.xml.Element class to display an XML hierarchy in a tree view. The root Element is actually used as the root node of the TreeView, saving the overhead of parsing the DOM and then walking it again to build the tree structure:
http://svn.apache.org/repos/asf/pivot/trunk/tools/src/org/apache/pivot/tools/xml/ The app uses a custom node renderer to display the contents of each node. You might be able to do something similar in your app. You can see a live demo of the app here: http://pivot.apache.org/demos/xml-viewer.html Hope this helps, Greg On Apr 29, 2010, at 3:15 PM, [email protected] wrote: > Hi! > > I have to show a xml file in a TreeView. > I'm currently browsing a Java DOM document and add the NodeValue to > TreeBranch or TreeNode depending on what it is in the document. > > The TreeView looks good so far. > The problem is now that i have to show the xml code of selected nodes. > Well I can't get the attributes into the tree because TreeNode has only one > text. > But I need the attributes to identify the right node of which I show the XML > code right from the dom document. > > The most nodes, which I have to show in detail, have an id attribute. But > how can I add the ID to the tree without actually showing it to the user? > > thx! > regards > > -- > GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT! > Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
