Input

Once you've got an instance of XMLReader, you're going to want to parse some documents with it. There are two methods that do this:

public void parse (String systemID) throws SAXException 

public void parse (InputSource in) throws SAXException

In the last chapter you learned how these methods call back to the client application. What I want to look at now is how the document is fed into the parser.

The parse() method takes either a String containing a system ID or an InputSource object as an argument. An InputSource is a wrapper for the various kinds of input streams and readers from which an XML document can be read. If a system ID is passed to the parse() method, then it's used to construct a new InputSource object that can be passed ...

Get Processing XML with Java™: A Guide to SAX, DOM, JDOM, JAXP, and TrAX now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.