This week's book / license giveaways are in the JDBC and Relational Databases and Java in General forums.
We're giving away four copies each of PostGIS in Action and Java Advanced Topics Training and have the authors on-line!
See this thread and this one for details.
The moose likes XML and Related Technologies and the fly likes Creating XML having multiple nesting of elements, from a ResultSet Object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Creating XML having multiple nesting of elements, from a ResultSet Object" Watch "Creating XML having multiple nesting of elements, from a ResultSet Object" New topic
Author

Creating XML having multiple nesting of elements, from a ResultSet Object

Nikhil Vasaikar
Greenhorn

Joined: Sep 09, 2003
Posts: 22
How do I create an XML which has multiple nesting of parent and child nodes?
I have my data in a ResultSet Object.
[ October 01, 2003: Message edited by: Nikhil Vasaikar ]
[ October 01, 2003: Message edited by: Nikhil Vasaikar ]
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Originally posted by Nikhil Vasaikar:
How do I create an XML which has multiple nesting of parent and child nodes?
I have my data in a ResultSet Object.

Could you please tell me an example of what you mean by multiple nesting of parent and child nodes in XML


Spritle Software Blogs
Nikhil Vasaikar
Greenhorn

Joined: Sep 09, 2003
Posts: 22

The entire <ABCD> can be one row in the database
or There might be multiple internal tags say <ASD> representing multiple rows in the database. The data other than <ASD> will remain same in such case.

EDIT: I added CODE tags for you...
[ October 01, 2003: Message edited by: Lasse Koskela ]
[ October 02, 2003: Message edited by: Nikhil Vasaikar ]
Nikhil Vasaikar
Greenhorn

Joined: Sep 09, 2003
Posts: 22
Thank You Lasse.
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Hi,
Writing an xml is simillar to writing a simple text file. Unless you have some specific mapping conditions (that was specified in IBM tutorial i pointed earlier),all you have to do is read the resultset data objects and write them to the file(xml file) using java.io.*. But this is not the write approach when its comes to maintainance issue & elegancy but its solve the purpose.

Please also visit http://xml.apache.org/xindice/ and http://cocoon.apache.org/ to see whether it can solve your problem in longterm.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Creating XML having multiple nesting of elements, from a ResultSet Object