Swing JTree, XML, display and update
hi, calling xml processing experts.
I am developing a GUI with a JTree component t display some xml file content in hierarchical order, and display the attributes in a JTable when user selects a leaf node. User could also modify the attributes in the JTable. So far, everything accomplished, and works fine.
However, I wish some one could offer me some expert opinion to optimize some of the implementations.
1) i am using a org.jdom.Document as the data in the TreeModel, however, the when the JTable query iterates through the Document, it will display the string returned from the Element.toString(). (that is my understanding). The toString() method returns something like 'Element:Nodename' kind of thing. Thus, i have to develop a ElementWrapper which takes a org.jdom.Element as constructor argument, and returns the string which i want.
So, in the treeModel, i have to add some code, to wrap/unwrap the element, and it is maybe error prone. i hope somebody could provide me some better idea/hints?
I have attempted several ways:
* rewrite the Element in the org.jdom package, (seems ...ew... a bit awkward)
* try to create a class which extends org.jdom.Element, however, the Element works in a hierarchy, and the interface like getChild() always return a Element instance, and it does not allow down cast.
2) i want to add in some filter function on the JTree display, wich means i only want to display Elements with certain attributes. i need some Element invisible in the JTree display, however, they still needs to be in the Document tree, since i need to write them back.
How could i be able to implement it? also, i could do the filtering in the treeModel, however, i now find some hot discussion on XPath related stuff, how am i going to making use of that?
Lots of thanks in advance.

