Package javanet.staxutils
Class StAXContentHandler
java.lang.Object
org.xml.sax.helpers.DefaultHandler
javanet.staxutils.StAXContentHandler
- All Implemented Interfaces:
ContentHandler,DTDHandler,EntityResolver,ErrorHandler,LexicalHandler
- Direct Known Subclasses:
StAXEventContentHandler,StAXStreamContentHandler
Base class for SAX-to-STAX bridge classes that provides common
functionality.
- Version:
- $Revision: 1.3 $
- Author:
- Christian Niles
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringBufferBuffer containing text read within the current CDATA section.protected LocatorThe SAXLocatorprovided to the handler.protected booleanWhether the parser is currently within a CDATA section.protected SimpleNamespaceContextStack used to store declared namespaces.protected XMLReporterThe STAXXMLReporterregistered to receive notifications. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcharacters(char[] ch, int start, int length) voidcomment(char[] ch, int start, int length) voidendCDATA()voidvoidendDTD()voidendElement(String uri, String localName, String qName) voidvoidendPrefixMapping(String prefix) voidvoidstatic final voidparseQName(String qName, String[] results) Parses an XML qualified name, and places the resulting prefix and local name in the provided String array.protected voidreportException(String type, SAXException e) Used to report aSAXExceptionto theXMLReporterregistered with this handler.voidsetDocumentLocator(Locator locator) voidsetXMLReporter(XMLReporter reporter) Sets theXMLReporterto which warning and error messages will be sent.voidvoidvoidvoidstartElement(String uri, String localName, String qName, Attributes attributes) voidstartEntity(String name) voidstartPrefixMapping(String prefix, String uri) voidMethods inherited from class org.xml.sax.helpers.DefaultHandler
ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, skippedEntity, unparsedEntityDecl
-
Field Details
-
isCDATA
protected boolean isCDATAWhether the parser is currently within a CDATA section. -
CDATABuffer
Buffer containing text read within the current CDATA section. -
namespaces
Stack used to store declared namespaces. -
docLocator
The SAXLocatorprovided to the handler. -
reporter
The STAXXMLReporterregistered to receive notifications.
-
-
Constructor Details
-
StAXContentHandler
public StAXContentHandler() -
StAXContentHandler
-
-
Method Details
-
setXMLReporter
Sets theXMLReporterto which warning and error messages will be sent.- Parameters:
reporter- TheXMLReporterto notify of errors.
-
setDocumentLocator
- Specified by:
setDocumentLocatorin interfaceContentHandler- Overrides:
setDocumentLocatorin classDefaultHandler
-
getCurrentLocation
-
error
- Specified by:
errorin interfaceErrorHandler- Overrides:
errorin classDefaultHandler- Throws:
SAXException
-
fatalError
- Specified by:
fatalErrorin interfaceErrorHandler- Overrides:
fatalErrorin classDefaultHandler- Throws:
SAXException
-
warning
- Specified by:
warningin interfaceErrorHandler- Overrides:
warningin classDefaultHandler- Throws:
SAXException
-
startDocument
- Specified by:
startDocumentin interfaceContentHandler- Overrides:
startDocumentin classDefaultHandler- Throws:
SAXException
-
endDocument
- Specified by:
endDocumentin interfaceContentHandler- Overrides:
endDocumentin classDefaultHandler- Throws:
SAXException
-
startElement
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException - Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classDefaultHandler- Throws:
SAXException
-
endElement
- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin classDefaultHandler- Throws:
SAXException
-
startPrefixMapping
- Specified by:
startPrefixMappingin interfaceContentHandler- Overrides:
startPrefixMappingin classDefaultHandler- Throws:
SAXException
-
endPrefixMapping
- Specified by:
endPrefixMappingin interfaceContentHandler- Overrides:
endPrefixMappingin classDefaultHandler- Throws:
SAXException
-
startCDATA
- Specified by:
startCDATAin interfaceLexicalHandler- Throws:
SAXException
-
characters
- Specified by:
charactersin interfaceContentHandler- Overrides:
charactersin classDefaultHandler- Throws:
SAXException
-
endCDATA
- Specified by:
endCDATAin interfaceLexicalHandler- Throws:
SAXException
-
comment
- Specified by:
commentin interfaceLexicalHandler- Throws:
SAXException
-
endDTD
- Specified by:
endDTDin interfaceLexicalHandler- Throws:
SAXException
-
endEntity
- Specified by:
endEntityin interfaceLexicalHandler- Throws:
SAXException
-
startDTD
- Specified by:
startDTDin interfaceLexicalHandler- Throws:
SAXException
-
startEntity
- Specified by:
startEntityin interfaceLexicalHandler- Throws:
SAXException
-
reportException
Used to report aSAXExceptionto theXMLReporterregistered with this handler.- Throws:
SAXException
-
parseQName
Parses an XML qualified name, and places the resulting prefix and local name in the provided String array.- Parameters:
qName- The qualified name to parse.results- An array where parse results will be placed. The prefix will be placed atresults[0], and the local part atresults[1]
-