File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes SAX and DOM parser Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "SAX and DOM parser" Watch "SAX and DOM parser" New topic
Author

SAX and DOM parser

neha priya
Ranch Hand

Joined: Jul 03, 2010
Posts: 62
Hi,
I need to know which one of DOM or SAX parser is better?I need to generate a new xml file from an existing xml template on server.

Kindly help.

Regards.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18655
    
    8

If I had an assignment like that ("generate one XML file from another XML file") then the first tool I would consider would be XSLT. I wouldn't consider low-level tools like SAX and DOM parsers until I was sure that XSLT couldn't do the job.
neha priya
Ranch Hand

Joined: Jul 03, 2010
Posts: 62
Thanks for the reply.In my case i have a xml template on the server.I need to collect data across various jsp pages and create a new xml file based on the xml template and populate the collected data over there.At the end of this, the template xml should remain as it was before.How do i use XSLT as you mentioned to achieve the same.
Kindly Help.

Regards.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18655
    
    8

I have no idea. It would depend on what data you were collecting and how much of it there was and how it was structured. If you're going to do this kind of evaluation you have to produce a proper set of requirements.
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
If I had an assignment like that ("generate one XML file from another XML file") then the first tool I would consider would be Perl. I wouldn't consider XSLT because of it's awkward programming style and inability to store program data efficiently. Moreover, the pattern-matching features of Perl are very powerful and flexible.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SAX and DOM parser