Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > How to convert TreePath object into an XML file?

Reply
Thread Tools

How to convert TreePath object into an XML file?

 
 
Prakash
Guest
Posts: n/a
 
      05-11-2004
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.
 
Reply With Quote
 
 
 
 
Salmo Bytes
Guest
Posts: n/a
 
      05-12-2004
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);
}
 
Reply With Quote
 
 
 
 
Prakash
Guest
Posts: n/a
 
      05-12-2004
Any suggestions on this?

http://www.velocityreviews.com/forums/(E-Mail Removed) (Prakash) wrote in message news:<(E-Mail Removed). com>...
> 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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert File Object into Class Object Aned Java 2 09-15-2007 07:37 PM
Convert a XML DOM Object to a HTML DOM Object manjunath.d@gmail.com XML 0 09-20-2005 08:16 AM
Testing JTree setSelectionPath(TreePath path)? carlg@libertybasic.com Java 1 01-03-2005 04:02 AM
Tools to extract data from SQL database and convert it into XML & insert XML data into SQL databases Harry Zoroc XML 1 07-12-2004 10:10 PM
how to write some xml into huge xml file into speceific location??? Xenia XML 4 11-25-2003 07:14 PM



Advertisments