Java Reference
In-Depth Information
methodistypicallyoverriddentoreportthewarningviaaconsoleortologitto
a file or a database.
Each method is declared to throw
SAXException
, which an overriding callback
method might choose to throw when it detects a problem.
LexicalHandler
declaresthefollowingadditionalcontent-orientedinformational
callback methods:
•
void comment(char[] ch, int start, int length)
reports
a comment via the
ch
array. The arguments that are passed to
start
and
length
identify that portion of the array that's relevant to this method call.
•
void endCDATA()
reports the end of a CDATA section.
•
void endDTD()
reports the end of a DTD.
•
void endEntity(String name)
reportsthestartoftheentityidentified
by
name
.
•
void startCDATA()
reports the start of a CDATA section.
•
void startDTD(String name, String publicId, String
systemId)
reportsthestartoftheDTDidentifiedby
name
.
publicId
spe-
cifies the declared public identifier for the external DTD subset, or is the null
referencewhennonewasdeclared.Similarly,
systemId
specifiesthedeclared
systemidentifierfortheexternalDTDsubset,oristhenullreferencewhennone
was declared.
•
void startEntity(String name)
reportsthestartoftheentityidenti-
fied by
name
.
Each method is declared to throw
SAXException
, which an overriding callback
method might choose to throw when it detects a problem.
Because it can be tedious to implement all the methods in each interface, the SAX
API conveniently provides the
org.xml.sax.helpers.DefaultHandler
ad-
apter class to relieve you of this tedium.
DefaultHandler
implements
Con-
tentHandler
,
DTDHandler
,
EntityResolver
, and
ErrorHandler
. SAX
also provides
org.xml.sax.ext.DefaultHandler2
, which subclasses
De-
faultHandler
, and which also implements
LexicalHandler
.