Receiving Documents

In general, a single XMLReader may parse multiple documents and may do so with the same ContentHandler. Consequently, it's important to tell where one document ends and the next document begins. To provide this information, the parser invokes startDocument() as soon as it begins parsing a new document and before it invokes any other methods in ContentHandler. It calls endDocument() after it has finished parsing the document, and it will not report any further content from that document. No arguments are passed to either of these methods, which serve no purpose other than marking the beginning and end of a complete XML document.

Because an XMLReader may parse multiple documents with the same ContentHandler object, per-document ...

Get Processing XML with Java™: A Guide to SAX, DOM, JDOM, JAXP, and TrAX 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.