@MinDoc(copyright="Copyright 2005, 2009 A. Weinert", author="Albrecht Weinert", version="V.33", lastModified="27.03.2021", usage="use as is or extend for own (SAX) XML parsers", purpose="provide a comfortable (base for) XML parsers") public class SAXHandler extends ParseErrorHandler implements ErrorHandler, ContentHandler
ParseErrorHandler, objects of this class are error
handlers for XML parsers. Additionally they implement a content handler
for SAX parser, hence being able to act as the one (and only) common
handler for SAX applications.startElement(String, String, String, Attributes). For many
application cases this as only change in an inheritor is sufficient.ContentHandler
methods in this class do nothing.GrafHelper.MBarFactory is one
example of a class extending SAXHandler. By comparably simple
overriding of just startDocument(),
startElement()
and endElement() it is a
powerful factory for MenuBars or
JMenuBars.de.frame4jerrorCount, fatalCount, log, name, reThrow, warningCount| Constructor and Description |
|---|
SAXHandler(CharSequence name,
PrintWriter log,
boolean reThrow)
SAXHandler by name of the XML input and with report output.
|
| Modifier and Type | Method and Description |
|---|---|
void |
characters(char[] ch,
int start,
int length)
This implementation does nothing.
|
void |
endDocument()
This implementation does nothing.
|
void |
endElement(String namespaceURI,
String localName,
String qName)
This implementation does nothing.
|
void |
endPrefixMapping(String prefix)
This implementation does nothing.
|
Object |
getProduct()
Deliver the product of the (ready, successful) parsing.
|
void |
ignorableWhitespace(char[] ch,
int start,
int length)
This implementation does nothing.
|
void |
processingInstruction(String target,
String data)
This implementation does nothing.
|
void |
setDocumentLocator(Locator locator)
This implementation does nothing.
|
void |
skippedEntity(String name)
This implementation does nothing.
|
void |
startDocument()
This implementation does nothing.
|
void |
startElement(String namespaceURI,
String localName,
String qName,
Attributes atts)
Start of a XML elements.
|
void |
startPrefixMapping(String prefix,
String uri)
This implementation does nothing.
|
appRep, error, fatalError, getName, init, report, reportErrors, toString, toStringBuilder, warningclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waiterror, fatalError, warningpublic SAXHandler(CharSequence name, PrintWriter log, boolean reThrow)
SAXHandler object will be made named according to
the parameter ParseErrorHandler.name or "...".ParseErrorHandler.log the parameter log is taken if not
null and the (decorated) normal output (System.out) otherwise.name - the handler's or the input's name (stripped from surrounding
white space; null or empty is taken as "..."log - destination for reportsreThrow - if true error exceptions are thrown (again) and not just
reportedParseErrorHandler.init(CharSequence, boolean),
ParseErrorHandler(CharSequence, PrintWriter, boolean)public Object getProduct()
public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException
ParseErrorHandler.log. This method and hence this class is a first useful
test step for the intended SAX application.startElement in interface ContentHandlerSAXExceptionContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)public void endDocument()
throws SAXException
endDocument in interface ContentHandlerSAXExceptionContentHandler.endDocument()public void startDocument()
throws SAXException
startDocument in interface ContentHandlerSAXExceptionContentHandler.startDocument()public void characters(char[] ch,
int start,
int length)
throws SAXException
characters in interface ContentHandlerSAXExceptionContentHandler.characters(char[], int, int)public void ignorableWhitespace(char[] ch,
int start,
int length)
throws SAXException
ignorableWhitespace in interface ContentHandlerSAXExceptionContentHandler.ignorableWhitespace(char[], int, int)public void endPrefixMapping(String prefix) throws SAXException
endPrefixMapping in interface ContentHandlerSAXExceptionContentHandler.endPrefixMapping(java.lang.String)public void skippedEntity(String name) throws SAXException
skippedEntity in interface ContentHandlerSAXExceptionContentHandler.skippedEntity(java.lang.String)public void setDocumentLocator(Locator locator)
setDocumentLocator in interface ContentHandlerContentHandler.setDocumentLocator(org.xml.sax.Locator)public void processingInstruction(String target, String data) throws SAXException
processingInstruction in interface ContentHandlerSAXExceptionContentHandler.processingInstruction(String, java.lang.String)public void startPrefixMapping(String prefix, String uri) throws SAXException
startPrefixMapping in interface ContentHandlerSAXExceptionContentHandler.startPrefixMapping(String, String)public void endElement(String namespaceURI, String localName, String qName) throws SAXException
endElement in interface ContentHandlerSAXExceptionContentHandler.endElement(String, String, String)