Parsing an XML Document with Java

As noted earlier, there are two basic interfaces to XML parsers: SAX, which supports low-overhead, event-based processing, and DOM, which represents the result of parsing in a tree data structure that can be used with XML (or HTML).

Let's look at how to parse XML with these interfaces. Later chapters will discuss in detail how to work with the results of this parsing: Chapter 15 will present DOM, and Chapter 16 will present SAX. This chapter will only summarize the most important non-standard features and show you how to get started. You need to see those nonstandard features to use DOM, and you'll need to read about DOM or SAX to write a useful program!

To make things easier, you'll learn how to do one particular ...

Get XML Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.