This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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 ;)
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,