public class XMLSAXHandler extends DefaultHandler
This class contains one stack used to store part of the parse tree. The ElementHandlers found on the stack have direct next handlers placed on the stack. So here's the warning, be careful to read how you may be affecting (or forgetting to affect) the stack.
If a FlowHandler implementation is available in the hints, the handler will periodically check it to see if it should stop parsing. See the FlowHandler interface.
This is an XML Schema driven parser and resolveEntity(String, String) will ignore all
dtd references. If an EntityResolver is provided it will be used.
XMLElementHandler| Modifier and Type | Field and Description |
|---|---|
protected static Level |
level |
protected static Logger |
logger
the logger -- should be used for debugging (assuming there are bugs LOL)
|
| Constructor and Description |
|---|
XMLSAXHandler(Map<String,Object> hints)
This contructor is intended to create an XMLSAXHandler to be used when
parsing an XML instance document.
|
XMLSAXHandler(URI intendedDocument,
Map hints)
This contructor is intended to create an XMLSAXHandler to be used when parsing an XML
instance document.
|
| Modifier and Type | Method and Description |
|---|---|
void |
characters(char[] ch,
int start,
int length)
Implementation of characters.
|
void |
endDocument()
Implementation of endDocument.
|
void |
endElement(String namespaceURI,
String localName,
String qName)
Implementation of endElement.
|
void |
endPrefixMapping(String prefix) |
void |
error(SAXParseException exception)
Implementation of error.
|
void |
fatalError(SAXParseException exception)
Implementation of fatalError.
|
Object |
getDocument()
getDocument purpose.
|
EntityResolver |
getEntityResolver() |
protected void |
init(Map<String,Object> hints) |
InputSource |
resolveEntity(String publicId,
String systemId)
Delegate to
entityResolver if available. |
void |
setDocumentLocator(Locator locator)
Stores the locator for future error reporting
|
void |
setEntityResolver(EntityResolver entityResolver) |
static void |
setLogLevel(Level l)
Used to set the logger level for all XMLSAXHandlers
|
void |
startDocument()
Implementation of startDocument.
|
void |
startElement(String namespaceURI,
String localName,
String qName,
Attributes atts)
Implementation of startElement.
|
void |
startPrefixMapping(String prefix,
String uri) |
void |
warning(SAXParseException exception)
Implementation of warning.
|
ignorableWhitespace, notationDecl, processingInstruction, skippedEntity, unparsedEntityDeclprotected static final Logger logger
protected static Level level
public XMLSAXHandler(URI intendedDocument, Map hints)
intendedDocument - hints - DOCUMENT ME!public XMLSAXHandler(Map<String,Object> hints)
This contructor is intended to create an XMLSAXHandler to be used when parsing an XML instance document. The instance document's uri is also be provided, as this will allow the parser to resolve relative uri's.
hints - Hints as per {@link XMLHandlerHints}public void setEntityResolver(EntityResolver entityResolver)
public EntityResolver getEntityResolver()
public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException
entityResolver if available.
Note this is an XMLSchema based parser, all attempts to resolved DTDs are rejected.
resolveEntity in interface EntityResolverresolveEntity in class DefaultHandlerpublicId - The public identifier, or null if none is available.systemId - The system identifier provided in the XML document.IOException - If there is an error setting up the new input source.SAXException - Any SAX exception, possibly wrapping another exception.public void endDocument()
endDocument in interface ContentHandlerendDocument in class DefaultHandlerContentHandler.endDocument()public void startDocument()
startDocument in interface ContentHandlerstartDocument in class DefaultHandlerContentHandler.startDocument()public void characters(char[] ch,
int start,
int length)
throws SAXException
characters in interface ContentHandlercharacters in class DefaultHandlerch - start - length - SAXExceptionContentHandler.characters(char[], int, int)public void endElement(String namespaceURI, String localName, String qName) throws SAXException
endElement in interface ContentHandlerendElement in class DefaultHandlernamespaceURI - localName - qName - SAXExceptionContentHandler.endElement(java.lang.String, java.lang.String,
java.lang.String)public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException
startElement in interface ContentHandlerstartElement in class DefaultHandlernamespaceURI - localName - qName - atts - SAXExceptionContentHandler.startElement(java.lang.String, java.lang.String,
java.lang.String, org.xml.sax.Attributes)public static void setLogLevel(Level l)
l - public Object getDocument() throws SAXException
Completes the post-processing phase, and returns the value from the parse ...
SAXExceptionDocumentHandler.getValue()public void error(SAXParseException exception)
error in interface ErrorHandlererror in class DefaultHandlerexception - ErrorHandler.error(org.xml.sax.SAXParseException)public void fatalError(SAXParseException exception) throws SAXException
fatalError in interface ErrorHandlerfatalError in class DefaultHandlerexception - SAXExceptionErrorHandler.fatalError(org.xml.sax.SAXParseException)public void warning(SAXParseException exception)
warning in interface ErrorHandlerwarning in class DefaultHandlerexception - ErrorHandler.warning(org.xml.sax.SAXParseException)public void setDocumentLocator(Locator locator)
setDocumentLocator in interface ContentHandlersetDocumentLocator in class DefaultHandlerContentHandler.setDocumentLocator(org.xml.sax.Locator)public void endPrefixMapping(String prefix)
endPrefixMapping in interface ContentHandlerendPrefixMapping in class DefaultHandlerContentHandler.endPrefixMapping(java.lang.String)public void startPrefixMapping(String prefix, String uri)
startPrefixMapping in interface ContentHandlerstartPrefixMapping in class DefaultHandlerContentHandler.startPrefixMapping(java.lang.String, java.lang.String)Copyright © 1996–2019 Geotools. All rights reserved.