This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes xml and jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "xml and jsp" Watch "xml and jsp" New topic

xml and jsp

Sunesh Kumar
Ranch Hand

Joined: Oct 17, 2005
Posts: 89
Hi Friends,

I am developing an application in which i have to read an xml, which is created by the data in all the tables in the database.

Now i have to read that xml and have to insert into databse when ever required.

My problem is that

NodeList orders = ordersRoot.getElementsByTagName("order");
NodeList products = ordersRoot.getElementsByTagName("product"); on

where order and product are can i give like this directly as the tables may vary..then how can i read and insert

can any one please suggest me...

Thanks & Regards<br />Sunesh Kumar Baachu
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63540

There appears to be no real JSP component to this question so I have moved it to the XML forum.

[Asking smart questions] [About Bear] [Books by Bear]
Paul Clapham

Joined: Oct 14, 2005
Posts: 19857

So you don't know what element name you will be looking for? Then you would just have to read the elements and find out what their names are. I will give you a link to a DOM tutorial:

And if you google for "java dom tutorial" or "java xml tutorial" you will find more similar tutorials.
Sunesh Kumar
Ranch Hand

Joined: Oct 17, 2005
Posts: 89
Hi Paul,

Can you please guide me with an example...

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42959
There are examples of how to read an XML file with either DOM or SAX here.
jQuery in Action, 3rd edition
subject: xml and jsp
It's not a secret anymore!