This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

xml and jsp

 
Sunesh Kumar
Ranch Hand
Posts: 89
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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");
....so on

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

can any one please suggest me...
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64196
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There appears to be no real JSP component to this question so I have moved it to the XML forum.
 
Paul Clapham
Sheriff
Pie
Posts: 20196
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:

http://java.sun.com/webservices/jaxp/dist/1.1/docs/tutorial/dom/index.html

And if you google for "java dom tutorial" or "java xml tutorial" you will find more similar tutorials.
 
Sunesh Kumar
Ranch Hand
Posts: 89
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Paul,

Can you please guide me with an example...

Bye
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are examples of how to read an XML file with either DOM or SAX here.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic