Skip to Content
Java™ Phrasebook
book

Java™ Phrasebook

by Timothy Fisher
November 2006
Intermediate to advanced
224 pages
3h 29m
English
Sams
Content preview from Java™ Phrasebook

Parsing XML with SAX

XMLReader parser =
											XMLReaderFactory.createXMLReader(
											"org.apache.xerces.parsers.SAXParser");
											parser.setContentHandler(new MyXMLHandler( ));
											parser.parse("document.xml");

The SAX API works by scanning through an XML document from start to finish and providing callbacks for events that occur within the XML document. The events include things such as the start of an element, the end of an element, the start of an attribute, the end of an attribute, and so on. In this phrase, we create an XMLReader instance using the SAXParser. After we have created the parser instance, we then set a content handler using the setContentHandler() method. The content handler is a class that defines the various callback methods that will be called ...

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

Ruby Phrasebook

Ruby Phrasebook

Jason Clinton
Wicked Cool Java

Wicked Cool Java

Brian D. Eubanks
Just Java™ 2

Just Java™ 2

Peter van der Linden
What Employees Want Most in Uncertain Times

What Employees Want Most in Uncertain Times

Kristine W. Powers, Jessica B.B. Diaz

Publisher Resources

ISBN: 0768668255Purchase book