aspose file tools*
The moose likes XML and Related Technologies and the fly likes writing into xml as wells as into tables 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 "writing into xml as wells as into tables" Watch "writing into xml as wells as into tables" New topic
Author

writing into xml as wells as into tables

kesava chaitanya
Ranch Hand

Joined: Aug 15, 2001
Posts: 140
in our project requirement like this;we have database tables like this
Country
States
City
in the jsp forum , fields like this
country:........
state:........
city:.........
when i submit the FORUM corresponding fields should enter into database as well as should create one xml file
like this:
<?xml version='1.0'?>
<root>
<country>india</country>
<state>karnataka</state>
<city>bangalore</city>
</root>
when i enter different fields in the forum and enter submit; the xml should overwrite with the previous values like this;
<?xml version='1.0'?>
<root>
<country>india</country>
<state>karnataka</state>
<city>bangalore</city>
<country>india</country>
<state>tamilnadu</state>
<city>chennai</city>
</root>
can anybody provide any links how to do this ?can i use xml schema for this
application
bye
chaitu
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
So you got two thigns to do on submit event.
1. load to database
2. Write/update XML file
For writing to a table. You can use jdbc api to to connect and use any database, A good tutorial is available here.
For writing/updating xml.
I can think of two options now.
1.Read the database table and create an xml file using simple File IO
2.Create an XML, and edit/modify/remove them using DOM api.
IBM has a basic tutorial on understanding DOM
Having a schema is is always better for future applicaiton upgrades and maintainability, data exchange and presentations etc., BUT not really necessary.


Spritle Software Blogs
kesava chaitanya
Ranch Hand

Joined: Aug 15, 2001
Posts: 140
Originally posted by Balaji Loganathan:
So you got two thigns to do on submit event.
1. load to database
2. Write/update XML file
For writing to a table. You can use jdbc api to to connect and use any database, A good tutorial is available here.
For writing/updating xml.
I can think of two options now.
1.Read the database table and create an xml file using simple File IO
2.Create an XML, and edit/modify/remove them using DOM api.
IBM has a basic tutorial on understanding DOM
Having a schema is is always better for future applicaiton upgrades and maintainability, data exchange and presentations etc., BUT not really necessary.


thank u for ur suggestion?what about JDOM?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: writing into xml as wells as into tables