Esri Geoportal Server
1.0

com.esri.gpt.framework.xml
Class BaseSaxHandler

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by com.esri.gpt.framework.xml.BaseSaxHandler
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler

public class BaseSaxHandler
extends DefaultHandler

Handles core SAX events during the parsing of an XML document.


Constructor Summary
BaseSaxHandler()
          Default constructor.
 
Method Summary
 void characters(char[] ch, int start, int length)
          Sets text node characters for a SAX element.
 void endDocument()
          Ends the SAX document.
 void endElement(String uri, String localName, String qName)
          Ends a SAX element.
protected  void onEndSaxElement(String uri, String localName, String qName, String localPath, String textNodeValue)
          Triggered when an element is ended during the parsing of an XML document.
protected  void onStartSaxElement(String uri, String localName, String qName, String localPath, Attributes attributes)
          Triggered when an element is started during the parsing of an XML document.
 void parse(String xml, boolean namespaceAware)
          Starts a SAX parser on an XML string.
 void startDocument()
          Starts the SAX document.
 void startElement(String uri, String localName, String qName, Attributes attributes)
          Starts a SAX element.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseSaxHandler

public BaseSaxHandler()
Default constructor.

Method Detail

characters

public final void characters(char[] ch,
                             int start,
                             int length)
                      throws SAXException
Sets text node characters for a SAX element.
This is a core method for a SAX DefaultHandler.

Specified by:
characters in interface ContentHandler
Overrides:
characters in class DefaultHandler
Parameters:
ch - the array of characters
start - the starting position within the array
length - the number of characters to read from the array
Throws:
SAXException - if the exception occurs

endDocument

public void endDocument()
                 throws SAXException
Ends the SAX document.
This is a core method for a SAX DefaultHandler.

Specified by:
endDocument in interface ContentHandler
Overrides:
endDocument in class DefaultHandler
Throws:
SAXException - if a SAXException occurs

endElement

public final void endElement(String uri,
                             String localName,
                             String qName)
                      throws SAXException
Ends a SAX element.
This is a core method for a SAX DefaultHandler.
An onEndSaxElement event is triggered.

Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class DefaultHandler
Parameters:
uri - the uri namespace for the element
localName - the local name for the element
qName - the qualified name for the element
Throws:
SAXException - if a SAXException occurs

onEndSaxElement

protected void onEndSaxElement(String uri,
                               String localName,
                               String qName,
                               String localPath,
                               String textNodeValue)
                        throws SAXException
Triggered when an element is ended during the parsing of an XML document.
There is no default implementation.

Parameters:
uri - the uri namespace for the element
localName - the local name for the element
qName - the qualified name for the element
localPath - the local path for the element
textNodeValue - the text node value for the element
Throws:
SAXException - if a SAXException occurs

onStartSaxElement

protected void onStartSaxElement(String uri,
                                 String localName,
                                 String qName,
                                 String localPath,
                                 Attributes attributes)
                          throws SAXException
Triggered when an element is started during the parsing of an XML document.
There is no default implementation.

Parameters:
uri - the uri namespace for the element
localName - the local name for the element
qName - the qualified name for the element
localPath - the local path for the element
attributes - the attributes for the element
Throws:
SAXException - if a SAXException occurs

parse

public void parse(String xml,
                  boolean namespaceAware)
           throws ParserConfigurationException,
                  SAXException,
                  IOException
Starts a SAX parser on an XML string.

Parameters:
xml - the XML string to parse
namespaceAware - flag indication if the parser should be namespace aware
Throws:
ParserConfigurationException - if the exception occurs
SAXException - if the exception occurs
IOException - if the exception occurs

startDocument

public void startDocument()
                   throws SAXException
Starts the SAX document.
This is a core method for a SAX DefaultHandler.

Specified by:
startDocument in interface ContentHandler
Overrides:
startDocument in class DefaultHandler
Throws:
SAXException - if a SAXException occurs

startElement

public final void startElement(String uri,
                               String localName,
                               String qName,
                               Attributes attributes)
                        throws SAXException
Starts a SAX element.
This is a core method for a SAX DefaultHandler.
An onStartSaxElement event is triggered.

Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class DefaultHandler
Parameters:
uri - the uri namespace for the element
localName - the local name for the element
qName - the qualified name for the element
attributes - the attributes for the element
Throws:
SAXException - if a SAXException occurs

Esri Geoportal Server
1.0

Copyright 2011 Environmental Systems Research Institute. All rights reserved. Use is subject to license terms.