Document Information Item

The Document Information Item is the root of the information found in an XML document. There is only one such root item.

This information item begins with the ContentHandler.startDocument() call and ends with the ContentHandler.endDocument() call. Many SAX2 event calls are used to construct its children or constituents.

Property Callbacks Explanation
[children] See the sections for each type of Information Item: Document Type Declaration (one, if present), Element (one), processing instruction (possibly many), Comment (possibly many).
[document element] This is the element in the [children] property.
[notations] See the section on Notation Information Items. (Unordered.)
[unparsed entities] See the section on Unparsed Entity Information Items. (Unordered.)
[base URI] Locator.getSystemId(), or XMLReader.parse() Locator may be used during the startDocument() callback (and earlier callbacks, unless they were made in the context of an external parameter entity).

Alternatively, for any parsers that don't provide a Locator, applications using an XMLReader are responsible for providing this information (if it exists) to the parse() method. This is passed directly as the string parameter or indirectly as the systemId property of an InputSource.

[character encoding scheme] unavailable; or InputSource.getEncoding() Normally this property is unavailable; it won't affect the interpretation of character data in Java. However, applications will in rare cases provide this to the parser when they call XMLReader.parse(InputSource) to start parsing. It's likely that an upcoming extension API will provide this information.
[standalone] XMLReader.getFeature() It's likely that an upcoming extension API will provide this information using an is-standalone feature flag.
[version] unavailable You can probably assume the value of this property is "1.0" for now. It's likely that an upcoming extension API will provide this information.
[all declarations processed] ContentHandler.skippedEntity(): LexicalHandler.endDTD() When endDTD() is invoked, the value of this property is known. If no external parameter entities are reported as skipped, then the value is true. If the parser doesn't support the lexical handler, then the later call to startElement() may be used instead of endDTD().

Because text in Java is always accessed using UTF-16 character strings or arrays, most applications won't need to worry about encoding issues; the SAX2 parser handles that. However, there are cases when encoding may matter: