Java Reference
In-Depth Information
public attribute value (the null reference when this value is not available),
and systemId provides this declaration's system attribute value.
void unparsedEntityDecl(String name, String publicId,
String systemId, String notationName) reportsanexternalun-
parsed entity declaration, where name provides the value of this declaration's
name attribute, publicId provides the value of the public attribute (the
nullreferencewhenthisvalueisnotavailable), systemId providesthevalue
of the system attribute, and notationName provides the NDATA name.
Each method is declared to throw SAXException , which an overriding callback
method might choose to throw when it detects a problem.
EntityResolver declares the following callback method:
InputSource resolveEntity(String publicId, String
systemId) is called to let the application resolve an external entity (such
as an external DTD subset) by returning a custom InputSource instance
that'sbasedonadifferentURI.Thismethodisdeclaredtothrow SAXExcep-
tion when it detects a SAX-oriented problem, and is also declared to throw
IOException whenitencountersanI/Oerror,possiblyinresponsetocreat-
ingan InputStream instanceora java.io.Reader instanceforthe In-
putSource being created.
ErrorHandler declaresthefollowingerror-orientedinformationalcallbackmeth-
ods:
void error(SAXParseException exception) reportsthatarecov-
erableparsererror(typicallythedocumentisnotvalid)hasoccurred;thedetails
arespecifiedviatheargumentpassedto exception .Thismethodistypically
overriddentoreporttheerrorviaacommandwindow(see Chapter1 )ortolog
it to a file or a database.
void fatalError(SAXParseException exception) reports that
anunrecoverableparsererror(thedocumentisnotwellformed)hasoccurred;
thedetailsarespecifiedviatheargumentpassedto exception .Thismethod
is typically overridden so that the application can log the error before it stops
processing the document (because the document is no longer reliable).
void warning(SAXParseException e) reportsthatanonerror(e.g.,
an element name begins with the reserved xml character sequence) has oc-
curred;thedetailsarespecifiedviatheargumentpassedto exception .This
Search WWH ::




Custom Search