XMLReader producer = ...;
LexicalHandler handler = ...;
producer.setProperty ("http://xml.org/sax/properties/lexical-handler",
handler);
// throws SAXNotSupportedException if parameter isn't a LexicalHandler
// throws SAXNotRecognizedException if parser doesn't support it.
The information this exposes is needed
for applications that need more in the way of "round-tripping"
support than the SAX2 core allows.
That is, less of the information read by parsers
will be completely discarded.
The application needs SAX to provide more complete support
for the XML Infoset (or for the XPath data model).
To completely support DOM, XPath, or XSLT on top of a SAX2
parser, this interface is as necessary as the namespaces
exposed in the SAX2 ContentHandler
and Attributes interfaces.
The downside is that much of this information is in the category
of information applications shouldn't want to deal with.
Be careful how you use these callbacks; don't assume that
just because the information is available, you should use it.
LexicalHandler has the following methods: