This extension interface defines methods that a
SAX parser can call to notify an application about the lexical
structure of an XML document. If your application requires this kind
of information (for example if it wants to create a new document that
has a similar structure to the one it reads), then pass an object
that implements this interface to the setProperty(
) method of an XMLReader, using the
property name
"http://www.xml.org/sax/properties/lexical-handler".
Because this is an extension handler, SAX parsers are not required to
support it, and may throw a
SAXNotRecognizedException or a
SAXNotSupportedException when you attempt to
register a DeclHandler.
If a LexicalHandler is successfully registered on
an XMLReader, then the parser will call
startDTD( ) and endDTD( ) to
report the beginning and end of the document's DTD.
It will call startCDATA( ) and endCDATA(
) to report the start and end of a CDATA
section. The content of the CDATA section will be
reported through the characters( ) method of the
ContentHandler interface. When the parser expands
an entity, it first calls startEntity( ) to
specify the name of the entity it is about to expand, and then calls
endEntity( ) when the entity expansion is
complete. Finally, whenever the parser encounters an XML comment, it
calls the comment( ) method.
public interface
LexicalHandler {
// Public Instance Methods
void
comment (char[ ]
ch , int
start , int
length )
throws org.xml.sax.SAXException;
void
endCDATA ( ) throws org.xml.sax.SAXException;
void
endDTD ( ) throws org.xml.sax.SAXException;
void
endEntity (String
name ) throws org.xml.sax.SAXException;
void
startCDATA ( ) throws org.xml.sax.SAXException;
void
startDTD (String
name , String
publicId , String
systemId )
throws org.xml.sax.SAXException;
void
startEntity (String
name ) throws org.xml.sax.SAXException;
}