Package gov.usgs.earthquake.qdm
Class RegionsHandler
java.lang.Object
org.xml.sax.helpers.DefaultHandler
gov.usgs.util.SAXAdapter
gov.usgs.earthquake.qdm.RegionsHandler
- All Implemented Interfaces:
ContentHandler
,DTDHandler
,EntityResolver
,ErrorHandler
XML SAX Handler for ANSS "regions.xml".
See the resource file
etc/config/regions.xml
Example:
InputStream in = ...
RegionsHanlder handler = new RegionsHandler();
try {
handler.parse(in)
} finally {
in.close();
}
return handler.regions;
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
onEndElement
(String uri, String localName, String qName, String content) End element handler.void
onStartElement
(String uri, String localName, String qName, Attributes attributes) Start Element handler.Methods inherited from class gov.usgs.util.SAXAdapter
characters, endElement, parse, parse, startElement
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.xml.sax.ContentHandler
declaration
-
Field Details
-
LOGGER
Logger object -
regions
the regions that have been parsed -
updated
update timestamp -
formatVersion
reported format version (no version-specific logic implemented)
-
-
Constructor Details
-
RegionsHandler
public RegionsHandler()
-
-
Method Details
-
onStartElement
public void onStartElement(String uri, String localName, String qName, Attributes attributes) throws SAXException Start Element handler. Builds region objects, and parses other information.- Overrides:
onStartElement
in classSAXAdapter
- Parameters:
uri
- namespace of element.localName
- name of element.qName
- qualified name of element.attributes
- element attributes.- Throws:
SAXException
- if there is an error.
-
onEndElement
public void onEndElement(String uri, String localName, String qName, String content) throws SAXException End element handler. Adds built region objects to regions object.- Overrides:
onEndElement
in classSAXAdapter
- Parameters:
uri
- namespace of element.localName
- name of element.qName
- qualified name of element.content
- element content.- Throws:
SAXException
- if onEndElement throws a SAXException.
-