Skip to Content
Java and XML, 3rd Edition
book

Java and XML, 3rd Edition

by Brett McLaughlin, Justin Edelson
December 2006
Intermediate to advanced content levelIntermediate to advanced
479 pages
13h 52m
English
O'Reilly Media, Inc.
Content preview from Java and XML, 3rd Edition

Chapter 3. SAX

XML is fundamentally about data; programming with XML, then, has to be fundamentally about getting at that data. That process, called parsing, is the basic task of the APIs I’ll cover in the next several chapters. This chapter describes how an XML document is parsed, focusing on the events that occur within this process. These events are important, as they are all points where application-specific code can be inserted and data manipulation can occur.

I’m also going to introduce you to one of the two core XML APIs in Java: SAX, the Simple API for XML (http://www.saxproject.org). SAX is what makes insertion of this application-specific code into events possible. The interfaces provided in the SAX package are an important part of any programmer’s toolkit for handling XML. Even though the SAX classes are small and few in number, they provide a critical framework for Java and XML to operate within. Solid understanding of how they help in accessing XML data is critical to effectively leveraging XML in your Java programs.

Tip

For the impatient, the other of those two core APIs is DOM. Coverage of DOM begins in Chapter 5.

Setting Up SAX

I’m increasingly of the “learning is best done by doing” philosophy, so I’m not going to hit you with a bunch of concept and theory before getting to code. SAX is a simple API, so you only need to understand its basic model, and how to get the API on your machine; beyond that, code will be your best teacher.

Callbacks and Event-Based Programming ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Java & XML Data Binding

Java & XML Data Binding

Brett McLaughlin
Mastering Java 11 - Second Edition

Mastering Java 11 - Second Edition

Dr. Edward Lavieri Jr., Mandar Jog
XML in a Nutshell, 3rd Edition

XML in a Nutshell, 3rd Edition

Elliotte Rusty Harold, W. Scott Means

Publisher Resources

ISBN: 059610149XSupplemental ContentErrata Page