Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / May 2004

Tip: Looking for answers? Try searching our database.

How to convert TreePath object into an XML file?

Thread view: 
Prakash - 11 May 2004 12:09 GMT
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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.