javanet.staxutils
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
Locator provided 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
XMLReporter registered 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
SAXException to the XMLReporter
registered with this handler. |
void |
setDocumentLocator(Locator locator) |
void |
setXMLReporter(XMLReporter reporter)
Sets the
XMLReporter to 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, unparsedEntityDecl
protected boolean isCDATA
protected StringBuffer CDATABuffer
protected SimpleNamespaceContext namespaces
protected XMLReporter reporter
XMLReporter
registered to receive notifications.public StAXContentHandler()
public StAXContentHandler(XMLReporter reporter)
public void setXMLReporter(XMLReporter reporter)
XMLReporter
to which warning and error messages will be
sent.reporter
- The XMLReporter
to notify of errors.public void setDocumentLocator(Locator locator)
setDocumentLocator
in interface ContentHandler
setDocumentLocator
in class DefaultHandler
public Location getCurrentLocation()
public void error(SAXParseException e) throws SAXException
error
in interface ErrorHandler
error
in class DefaultHandler
SAXException
public void fatalError(SAXParseException e) throws SAXException
fatalError
in interface ErrorHandler
fatalError
in class DefaultHandler
SAXException
public void warning(SAXParseException e) throws SAXException
warning
in interface ErrorHandler
warning
in class DefaultHandler
SAXException
public void startDocument() throws SAXException
startDocument
in interface ContentHandler
startDocument
in class DefaultHandler
SAXException
public void endDocument() throws SAXException
endDocument
in interface ContentHandler
endDocument
in class DefaultHandler
SAXException
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException
startElement
in interface ContentHandler
startElement
in class DefaultHandler
SAXException
public void endElement(String uri, String localName, String qName) throws SAXException
endElement
in interface ContentHandler
endElement
in class DefaultHandler
SAXException
public void startPrefixMapping(String prefix, String uri) throws SAXException
startPrefixMapping
in interface ContentHandler
startPrefixMapping
in class DefaultHandler
SAXException
public void endPrefixMapping(String prefix) throws SAXException
endPrefixMapping
in interface ContentHandler
endPrefixMapping
in class DefaultHandler
SAXException
public void startCDATA() throws SAXException
startCDATA
in interface LexicalHandler
SAXException
public void characters(char[] ch, int start, int length) throws SAXException
characters
in interface ContentHandler
characters
in class DefaultHandler
SAXException
public void endCDATA() throws SAXException
endCDATA
in interface LexicalHandler
SAXException
public void comment(char[] ch, int start, int length) throws SAXException
comment
in interface LexicalHandler
SAXException
public void endDTD() throws SAXException
endDTD
in interface LexicalHandler
SAXException
public void endEntity(String name) throws SAXException
endEntity
in interface LexicalHandler
SAXException
public void startDTD(String name, String publicId, String systemId) throws SAXException
startDTD
in interface LexicalHandler
SAXException
public void startEntity(String name) throws SAXException
startEntity
in interface LexicalHandler
SAXException
protected void reportException(String type, SAXException e) throws SAXException
SAXException
to the XMLReporter
registered with this handler.SAXException
public 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]