Java Reference
In-Depth Information
endpositionofanydocument-relatedevent,evenwhentheparserisnotreport-
inganerror.Thismethodiscalledpriorto
startDocument()
,andisagood
placetosavethe
Locator
objectsothatitcanbeaccessedfromothercallback
methods.
•
void skippedEntity(String name)
reportsallskippedentities.Val-
idating parsers resolve all general entity references, but nonvalidating parsers
have the option of skipping them because nonvalidating parsers do not read
DTDswheretheseentitiesaredeclared.Ifthenonvalidatingparserdoesn'tread
aDTD,itwillnotknowifanentityisproperlydeclared.Insteadofattempting
toreadtheDTDandreporttheentity'sreplacementtext,thenonvalidatingpars-
er calls
skippedEntity()
with the entity's name.
•
void startDocument()
reports that the start of the document has been
reached. An application might use this method to create an output file or per-
form some other initialization.
•
void startElement(String uri, String localName,
String qName, Attributes attributes)
reports that the start of
an element has been reached.
uri
identifies the element's namespace URI,
or is empty when there is no namespace URI or namespace processing has
not been enabled.
localName
identifies the element's local name,
qName
references its qualified name, and
attributes
references an array of
org.xml.sax.Attribute
objects that identify the element's attrib-
utes—this array isempty whenthere are noattributes.
startElement()
is
invoked when a start tag or an empty-element tag is detected.
•
void startPrefixMapping(String prefix, String uri)
reports that the start of a namespace prefix mapping (
xm-
lns:h="http://www.w3.org/1999/xhtml"
, for example) has been
reached,where
prefix
reportsthisprefix(e.g.,
h
)and
uri
reportstheURIto
ample).
Eachmethodexceptfor
setDocumentLocator()
isdeclaredtothrow
SAXEx-
ception
,whichanoverridingcallbackmethodmightchoosetothrowwhenitdetects
a problem.
DTDHandler
declaresthefollowingDTD-orientedinformationalcallbackmethods:
•
void notationDecl(String name, String publicId,
String systemId)
reports a notation declaration, where
name
provides
thisdeclaration's
name
attributevalue,
publicId
providesthisdeclaration's