I recently had to teach/advise some fellow co-workers on XML parsing technologies (with Java). One of them knew nothing about XML at all – let alone XML parsing – the other was familiar with DOM and SAX basics. So, I started with a crash course on those both technologies, stressed their differences, AND introduced both of them to the XmlPull API.
In my opinion the XmlPull API which has led to StAX, the Streaming API for XML as per JSR-173, has not gained the recognition it deserves. Btw, check out the StAX crash course at Wikipedia for a neat introduction.
A “pull” based API that pulls relevant information from the XML tree – rather than “push”ing events as with SAX – lets you parse the document without the large memory consumption of a DOM and without the rather complicated event handling of SAX. It’s usually a very light API with some implementations specifically targeting J2ME applications. In my life as a software engineer I’ve seen too much abuse of DOM and SAX simply because people didn’t know that there are better alternatives available. I’ve found that XmlPull/StAX fits wonderfully for most use cases. It’s easy to learn & use, it’s extremly fast, and the memory footprint is minimal. What more do you want from an XML parsing API? Nothing more.