This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action 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 Newbie Question: XML on Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Newbie Question: XML on Java" Watch "Newbie Question: XML on Java" New topic

Newbie Question: XML on Java

Mark Fletcher
Ranch Hand

Joined: Dec 08, 2001
Posts: 897
Im about to start work on an application in Java which reads and writes XML files. My current understanding is that there are many API's for Java which can parse XML.
I was wondering if anyone out there could point me to any articles which compare and contrast these API's or could inform me directly of the pros and cons of each.
Previously my experience with XML has been using the MSXML API on Windows.
Thanks and Best Regards,

Mark Fletcher -
I had some Java certs, but they're too old now...
bernd pier
Ranch Hand

Joined: Jun 21, 2002
Posts: 30
hey mark,
i knew SAX,DOM,JDOM,JAXP to parse xml.
i`m just a beginner in java and xml, but i have some links for you:
DOM //this is the reference side including tutorials
the main difference between DOM and SAX is, that DOM hold the XML in a tree structure and you can access to any level, node or childnode to any time.
SAX parse the XML file line after line, so if SAX is in level 4 of the XML structure it`s impossible to access to level 2 or level 5. level 2 is parsed and lost and level 5 will be parsed.
when the XML file is very big, the DOM parser needs a lot of resources of cpu and memory to hold it and then it`s better to use the SAX parser.
at least you need a parser, i prefer xerces from apache.
i hope this help`s.
best wiches
Mark Fletcher
Ranch Hand

Joined: Dec 08, 2001
Posts: 897
Hi Bernd,
Thanks for the info. I'll probably give Xerces a look...
jQuery in Action, 2nd edition
subject: Newbie Question: XML on Java