Hi,

I am presently trying to display an XML document as a tree structure.
I am able to do it using JTree and SAX Parser.

Now I would like to get the parents of all non-leaf nodes and display them as sub-trees.

Does we have any function in JTree where I can retrieve the parents of non-leaf nodes and display them??

Please help.

Thanks!!

There isn't a specific function for that, but all you need to do is walk the tree and collect the parent references if node.isLeaf() is false.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.