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, unparsedEntityDecl
protected 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 EntityResolver
resolveEntity
in class DefaultHandler
publicId
- 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 ContentHandler
endDocument
in class DefaultHandler
ContentHandler.endDocument()
public void startDocument()
startDocument
in interface ContentHandler
startDocument
in class DefaultHandler
ContentHandler.startDocument()
public void characters(char[] ch, int start, int length) throws SAXException
characters
in interface ContentHandler
characters
in class DefaultHandler
ch
- start
- length
- SAXException
ContentHandler.characters(char[], int, int)
public void endElement(String namespaceURI, String localName, String qName) throws SAXException
endElement
in interface ContentHandler
endElement
in class DefaultHandler
namespaceURI
- localName
- qName
- SAXException
ContentHandler.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 ContentHandler
startElement
in class DefaultHandler
namespaceURI
- localName
- qName
- atts
- SAXException
ContentHandler.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 ...
SAXException
DocumentHandler.getValue()
public void error(SAXParseException exception)
error
in interface ErrorHandler
error
in class DefaultHandler
exception
- ErrorHandler.error(org.xml.sax.SAXParseException)
public void fatalError(SAXParseException exception) throws SAXException
fatalError
in interface ErrorHandler
fatalError
in class DefaultHandler
exception
- SAXException
ErrorHandler.fatalError(org.xml.sax.SAXParseException)
public void warning(SAXParseException exception)
warning
in interface ErrorHandler
warning
in class DefaultHandler
exception
- ErrorHandler.warning(org.xml.sax.SAXParseException)
public void setDocumentLocator(Locator locator)
setDocumentLocator
in interface ContentHandler
setDocumentLocator
in class DefaultHandler
ContentHandler.setDocumentLocator(org.xml.sax.Locator)
public void endPrefixMapping(String prefix)
endPrefixMapping
in interface ContentHandler
endPrefixMapping
in class DefaultHandler
ContentHandler.endPrefixMapping(java.lang.String)
public void startPrefixMapping(String prefix, String uri)
startPrefixMapping
in interface ContentHandler
startPrefixMapping
in class DefaultHandler
ContentHandler.startPrefixMapping(java.lang.String, java.lang.String)
Copyright © 1996–2019 Geotools. All rights reserved.