wood burning stoves*
The moose likes XML and Related Technologies and the fly likes is there a guide for what XML classes/principles work best depending on what you need to do? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "is there a guide for what XML classes/principles work best depending on what you need to do?" Watch "is there a guide for what XML classes/principles work best depending on what you need to do?" New topic
Author

is there a guide for what XML classes/principles work best depending on what you need to do?

J Westland
Ranch Hand

Joined: Apr 06, 2009
Posts: 40
Hi -

I have used a little XML in Java using DOM and Nodes/Document/Nodelist/Element classes/interfaces so I know how to read in an XML file. OK for those things it seems simple enough.

I could find out that DOM is best for if you will use information from the XML document many times, as SAX parses item by item and is therefore not so efficient if you need to do lots of reading/manipulation. However SAX will work if you don't want to/can't have the whole document in memory.

I wrote something basic for work but a colleague of mine used XPaths for example I don't. There is a reason for that, but I find it hard to work out when to use what XML classes

Then I opened the O'Reilly xml book and got a case of total information overload.
XPATH, XSLT, XQL...woa! There was not really clear overview of when to use what (OK, it's a reference not a HeadFirst book I know...) in the end I got a lot further with some basic tutorials and simply reading the JAVA API (thank you SCJP qualification)

I saw some XML books on Amazon.com but I don't really care about learning how to use something but more what to use when from a practical point of view. And since there's no headfirst XML... ;)

What book/site do you recommend on learning XML and wanting to understand what you're doing and why?




Woohoo passed SCJP 1.6, that's the theory exam passed now for the practice ;)
Jamie Zhang
Greenhorn

Joined: Jul 31, 2009
Posts: 9
Well, you are basically right about DOM and SAX, but XML processin technology has proressed a bit there are more options available for you to consider

1. StAX is similar to SAX as a streaming XML parser, but is generally considered easier to use since you pull nodes from XML, instead of receiving events, StAX's limitation is pretty similar to SAX otherwise.

2. VTD-XML basically does what DOM does, but is a lot more efficient in memory usage (1/3~1/5 of what DOM uses), and up to 12x faster in perfomrance, it additionally supports indexing, full XPath support, incremental update, and cut/paste/splitting/assembling,

http://vtd-xml.sf.net
J Westland
Ranch Hand

Joined: Apr 06, 2009
Posts: 40
Tx the vtd-xml sounds interesting
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: is there a guide for what XML classes/principles work best depending on what you need to do?
 
Similar Threads
Effective XML by Elliotte Rusty Harold
DOM or SAX confusing
Questions to Ajith, the XML guru
Errors in DOM/SAX Mock exams ???
Reading XML file from Server