Hi,
I want to convert the selected fields of a JTree, into an XML file.
The getSelectionPaths() of JTree returns a TreePath[] object.
But how do I convert this into an XML file?
Is there any standard java API for that?
NOTE: The JTree itself is constructed from an XML file.......
Thanks in advance,
Prakash.
Salmo Bytes - 12 May 2004 04:23 GMT
Recurse down through the tree nodes
For each node, call a function that builds the
openning element. If that element has children,
continue recursion, else complete the current element.
public String mkXML(String xml, MyNodeType node)
{
xml += startNode(xml);
Enumeration nodes = node.children();
while(nodes.hasMoreElements())
{
subnode = (MyNodeType)node.nextElement();
xml += mkXML(ret, subnode);
}
xml += endNode(node);
return (xml);
}
Prakash - 12 May 2004 07:33 GMT
Any suggestions on this?
> Hi,
>
[quoted text clipped - 7 lines]
> Thanks in advance,
> Prakash.