Class SAXParser
java.lang.Object
com.dalsemi.onewire.application.tag.SAXParser
- All Implemented Interfaces:
Parser
A SAX parser.
This class encapsulates the underlying parser implementation. We support only the SAX1 interface for now.
Specify the SAXParser implementation by adding the property
SAXParser.ClassName
to the onewire.properties file with the
fully qualified classname of an implementation of
org.xml.sax.Parser
. The default classname used is for nanoxml's
parser: nanoxml.sax.SAXParser
.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Parse an XML document specified by system identifier or URL.void
parse
(InputSource inputSource) Parse an XML document.void
setDocumentHandler
(DocumentHandler handler) Register a document event handler.void
setDTDHandler
(DTDHandler handler) Register a DTD event handler.void
setEntityResolver
(EntityResolver resolver) Register a custom entity resolver.void
setErrorHandler
(ErrorHandler handler) Register an error event handler.void
Set the locale for errors and warnings.
-
Constructor Details
-
SAXParser
public SAXParser()Construct the SAX parser.
-
-
Method Details
-
setLocale
Set the locale for errors and warnings.- Specified by:
setLocale
in interfaceParser
- Parameters:
locale
- The locale to use.- Throws:
SAXException
- If the locale is not supported.
-
setEntityResolver
Register a custom entity resolver. If one is not registered, the parser will resolve system identifiers in an implementation dependent way.- Specified by:
setEntityResolver
in interfaceParser
- Parameters:
resolver
- The entity resolver to use.
-
setDTDHandler
Register a DTD event handler. If one is not registered, all DTD events reported by the parser will be ignored.- Specified by:
setDTDHandler
in interfaceParser
- Parameters:
handler
- The DTD handler to use.
-
setDocumentHandler
Register a document event handler. If one is not registered, all document events reported by the parser will be ignored.- Specified by:
setDocumentHandler
in interfaceParser
- Parameters:
handler
- The document handler to use.
-
setErrorHandler
Register an error event handler. If one is not registered, all error events except forfatalError
are ignored. AfatalError
thorws aSAXException
.- Specified by:
setErrorHandler
in interfaceParser
- Parameters:
handler
- The error handler to use.
-
parse
Parse an XML document.- Specified by:
parse
in interfaceParser
- Parameters:
inputSource
- Source of the document to parse.- Throws:
SAXException
- Any SAX exception, possibly wrapping another exception.IOException
- If an I/O error occurred while reading the document.
-
parse
Parse an XML document specified by system identifier or URL.- Specified by:
parse
in interfaceParser
- Parameters:
systemID
- The system ID or URL of the document to parse.- Throws:
SAXException
- Any SAX exception, possibly wrapping another exception.IOException
- If an I/O error occurred while reading the document.
-