public abstract class StAXContentHandler extends DefaultHandler implements LexicalHandler
| Modifier and Type | Field and Description |
|---|---|
protected StringBuffer |
CDATABuffer
Buffer containing text read within the current CDATA section.
|
protected Locator |
docLocator
The SAX
Locatorprovided to the handler. |
protected boolean |
isCDATA
Whether the parser is currently within a CDATA section.
|
protected SimpleNamespaceContext |
namespaces
Stack used to store declared namespaces.
|
protected XMLReporter |
reporter
The STAX
XMLReporterregistered to receive notifications. |
| Constructor and Description |
|---|
StAXContentHandler() |
StAXContentHandler(XMLReporter reporter) |
| Modifier and Type | Method and Description |
|---|---|
void |
characters(char[] ch,
int start,
int length) |
void |
comment(char[] ch,
int start,
int length) |
void |
endCDATA() |
void |
endDocument() |
void |
endDTD() |
void |
endElement(String uri,
String localName,
String qName) |
void |
endEntity(String name) |
void |
endPrefixMapping(String prefix) |
void |
error(SAXParseException e) |
void |
fatalError(SAXParseException e) |
Location |
getCurrentLocation()
|
static void |
parseQName(String qName,
String[] results)
Parses an XML qualified name, and places the resulting prefix and local
name in the provided String array.
|
protected void |
reportException(String type,
SAXException e)
Used to report a
SAXExceptionto the XMLReporter registered
with this handler. |
void |
setDocumentLocator(Locator locator) |
void |
setXMLReporter(XMLReporter reporter)
Sets the
XMLReporterto which warning and error messages will be
sent. |
void |
startCDATA() |
void |
startDocument() |
void |
startDTD(String name,
String publicId,
String systemId) |
void |
startElement(String uri,
String localName,
String qName,
Attributes attributes) |
void |
startEntity(String name) |
void |
startPrefixMapping(String prefix,
String uri) |
void |
warning(SAXParseException e) |
ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, skippedEntity, unparsedEntityDeclprotected boolean isCDATA
protected StringBuffer CDATABuffer
protected SimpleNamespaceContext namespaces
protected XMLReporter reporter
XMLReporterregistered to receive notifications.public StAXContentHandler()
public StAXContentHandler(XMLReporter reporter)
public void setXMLReporter(XMLReporter reporter)
XMLReporterto which warning and error messages will be
sent.reporter - The XMLReporterto notify of errors.public void setDocumentLocator(Locator locator)
setDocumentLocator in interface ContentHandlersetDocumentLocator in class DefaultHandlerpublic Location getCurrentLocation()
public void error(SAXParseException e) throws SAXException
error in interface ErrorHandlererror in class DefaultHandlerSAXExceptionpublic void fatalError(SAXParseException e) throws SAXException
fatalError in interface ErrorHandlerfatalError in class DefaultHandlerSAXExceptionpublic void warning(SAXParseException e) throws SAXException
warning in interface ErrorHandlerwarning in class DefaultHandlerSAXExceptionpublic void startDocument()
throws SAXException
startDocument in interface ContentHandlerstartDocument in class DefaultHandlerSAXExceptionpublic void endDocument()
throws SAXException
endDocument in interface ContentHandlerendDocument in class DefaultHandlerSAXExceptionpublic void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException
startElement in interface ContentHandlerstartElement in class DefaultHandlerSAXExceptionpublic void endElement(String uri, String localName, String qName) throws SAXException
endElement in interface ContentHandlerendElement in class DefaultHandlerSAXExceptionpublic void startPrefixMapping(String prefix, String uri) throws SAXException
startPrefixMapping in interface ContentHandlerstartPrefixMapping in class DefaultHandlerSAXExceptionpublic void endPrefixMapping(String prefix) throws SAXException
endPrefixMapping in interface ContentHandlerendPrefixMapping in class DefaultHandlerSAXExceptionpublic void startCDATA()
throws SAXException
startCDATA in interface LexicalHandlerSAXExceptionpublic void characters(char[] ch,
int start,
int length)
throws SAXException
characters in interface ContentHandlercharacters in class DefaultHandlerSAXExceptionpublic void endCDATA()
throws SAXException
endCDATA in interface LexicalHandlerSAXExceptionpublic void comment(char[] ch,
int start,
int length)
throws SAXException
comment in interface LexicalHandlerSAXExceptionpublic void endDTD()
throws SAXException
endDTD in interface LexicalHandlerSAXExceptionpublic void endEntity(String name) throws SAXException
endEntity in interface LexicalHandlerSAXExceptionpublic void startDTD(String name, String publicId, String systemId) throws SAXException
startDTD in interface LexicalHandlerSAXExceptionpublic void startEntity(String name) throws SAXException
startEntity in interface LexicalHandlerSAXExceptionprotected void reportException(String type, SAXException e) throws SAXException
SAXExceptionto the XMLReporter registered
with this handler.SAXExceptionpublic static final void parseQName(String qName, String[] results)
qName - The qualified name to parse.results - An array where parse results will be placed. The prefix will be
placed at results[0], and the local part at
results[1]Copyright © 2019. All rights reserved.