Java Reference
In-Depth Information
void parse(InputSource input) parsesanXMLdocumentanddoes
not return until the document has been parsed. The input parameter stores
a reference to an org.xml.sax.InputSource instance, which describes
thedocument'ssource(suchasa java.io.InputStream instance,oreven
a java.lang.String -based system identifier URI). This method throws
java.io.IOException whenthesourcecannotberead,and SAXExcep-
tion when parsing fails, probably due to a wellformedness violation.
void parse(String systemId) parsesanXMLdocumentbyexecuting
parse(new InputSource(systemId)); .
void setContentHandler(ContentHandler handler) registers
the content handler identified by handler with the parser. The Con-
tentHandler interface provides eleven callback methods that are called to
report various parsing events (such as the start and end of an element).
void setDTDHandler(DTDHandler handler) registers the DTD
handler identified by handler with the parser. The DTDHandler interface
providesapairofcallbackmethodsforreportingonnotationsandexternalun-
parsed entities.
void setEntityResolver(EntityResolver resolver) registers
theentityresolveridentifiedby resolver withtheparser.The EntityRe-
solver interface provides a single callback method for resolving entities.
void setErrorHandler(ErrorHandler handler) registerstheer-
rorhandler identified by handler with the parser.The ErrorHandler in-
terface provides three callback methods that report fatal errors (problems that
preventfurtherparsing,suchaswellformednessviolations), recoverable errors
(problems that don't prevent further parsing, such as validation failures), and
warnings (nonerrors that need to be addressed, such as prefixing an element
name with the W3C-reserved xml prefix).
void setFeature(String name, boolean value) assigns value
to the feature identified by name , which must be a fully-qualified URI. This
methodthrows SAXNotRecognizedException whenthenameisnotre-
cognized as a feature, and throws SAXNotSupportedException when
the name is recognized but the associated value cannot be set when
setFeature() is called.
void setProperty(String name, Object value) assigns value
tothepropertyidentifiedby name ,whichmustbeafully-qualifiedURI.This
Search WWH ::




Custom Search