org.geotools.xml
Class XMLSAXHandler

Object
  extended by DefaultHandler
      extended by XMLSAXHandler
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler

public class XMLSAXHandler
extends DefaultHandler

XMLSAXHandler purpose.

This is a schema content handler. Code here has been modified from code written by Ian Schneider.

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.

Author:
dzwiers, Refractions Research, Inc. http://www.refractions.net, $Author:$ (last modification)
See Also:
XMLElementHandler
Module:
modules/library/xml (gt-xml.jar)

Field Summary
protected static Level level
           
protected static Logger logger
          the logger -- should be used for debugging (assuming there are bugs LOL)
 
Constructor Summary
XMLSAXHandler(Map 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.
 
Method Summary
 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.
 InputSource resolveEntity(String pubId, String sysId)
          TODO summary sentence for resolveEntity ...
 void setDocumentLocator(Locator locator)
          Stores the locator for future error reporting
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.
 
Methods inherited from class DefaultHandler
ignorableWhitespace, notationDecl, processingInstruction, skippedEntity, unparsedEntityDecl
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final Logger logger
the logger -- should be used for debugging (assuming there are bugs LOL)


level

protected static Level level
Constructor Detail

XMLSAXHandler

public XMLSAXHandler(URI intendedDocument,
                     Map 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.

Parameters:
intendedDocument -
hints - DOCUMENT ME!

XMLSAXHandler

public XMLSAXHandler(Map 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.

Parameters:
hints - DOCUMENT ME!
Method Detail

resolveEntity

public InputSource resolveEntity(String pubId,
                                 String sysId)
                          throws SAXException
TODO summary sentence for resolveEntity ...

Specified by:
resolveEntity in interface EntityResolver
Overrides:
resolveEntity in class DefaultHandler
Parameters:
pubId -
sysId -
Returns:
InputSource
Throws:
SAXException
See Also:
EntityResolver.resolveEntity(java.lang.String, java.lang.String)

endDocument

public void endDocument()
Implementation of endDocument.

Specified by:
endDocument in interface ContentHandler
Overrides:
endDocument in class DefaultHandler
See Also:
ContentHandler.endDocument()

startDocument

public void startDocument()
Implementation of startDocument.

Specified by:
startDocument in interface ContentHandler
Overrides:
startDocument in class DefaultHandler
See Also:
ContentHandler.startDocument()

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
Implementation of characters.

Specified by:
characters in interface ContentHandler
Overrides:
characters in class DefaultHandler
Parameters:
ch -
start -
length -
Throws:
SAXException
See Also:
ContentHandler.characters(char[], int, int)

endElement

public void endElement(String namespaceURI,
                       String localName,
                       String qName)
                throws SAXException
Implementation of endElement.

Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class DefaultHandler
Parameters:
namespaceURI -
localName -
qName -
Throws:
SAXException
See Also:
ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)

startElement

public void startElement(String namespaceURI,
                         String localName,
                         String qName,
                         Attributes atts)
                  throws SAXException
Implementation of startElement.

Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class DefaultHandler
Parameters:
namespaceURI -
localName -
qName -
atts -
Throws:
SAXException
See Also:
ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)

setLogLevel

public static void setLogLevel(Level l)

Used to set the logger level for all XMLSAXHandlers

Parameters:
l -

getDocument

public Object getDocument()
                   throws SAXException
getDocument purpose.

Completes the post-processing phase, and returns the value from the parse ...

Returns:
Object parsed
Throws:
SAXException
See Also:
DocumentHandler.getValue()

error

public void error(SAXParseException exception)
Implementation of error.

Specified by:
error in interface ErrorHandler
Overrides:
error in class DefaultHandler
Parameters:
exception -
See Also:
ErrorHandler.error(org.xml.sax.SAXParseException)

fatalError

public void fatalError(SAXParseException exception)
                throws SAXException
Implementation of fatalError.

Specified by:
fatalError in interface ErrorHandler
Overrides:
fatalError in class DefaultHandler
Parameters:
exception -
Throws:
SAXException
See Also:
ErrorHandler.fatalError(org.xml.sax.SAXParseException)

warning

public void warning(SAXParseException exception)
Implementation of warning.

Specified by:
warning in interface ErrorHandler
Overrides:
warning in class DefaultHandler
Parameters:
exception -
See Also:
ErrorHandler.warning(org.xml.sax.SAXParseException)

setDocumentLocator

public void setDocumentLocator(Locator locator)
Stores the locator for future error reporting

Specified by:
setDocumentLocator in interface ContentHandler
Overrides:
setDocumentLocator in class DefaultHandler
See Also:
ContentHandler.setDocumentLocator(org.xml.sax.Locator)

endPrefixMapping

public void endPrefixMapping(String prefix)
Specified by:
endPrefixMapping in interface ContentHandler
Overrides:
endPrefixMapping in class DefaultHandler
See Also:
ContentHandler.endPrefixMapping(java.lang.String)

startPrefixMapping

public void startPrefixMapping(String prefix,
                               String uri)
Specified by:
startPrefixMapping in interface ContentHandler
Overrides:
startPrefixMapping in class DefaultHandler
See Also:
ContentHandler.startPrefixMapping(java.lang.String, java.lang.String)


Copyright © 1996-2009 Geotools. All Rights Reserved.