Package gov.usgs.earthquake.shakemap
Class GridXMLHandler
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- gov.usgs.earthquake.shakemap.GridXMLHandler
-
- All Implemented Interfaces:
org.xml.sax.ContentHandler
,org.xml.sax.DTDHandler
,org.xml.sax.EntityResolver
,org.xml.sax.ErrorHandler
public class GridXMLHandler extends org.xml.sax.helpers.DefaultHandler
Parser for ShakeMap grid.xml metadata. Accepts a ShakeMap object and updates the properties of that product based on the product's grid.xml file.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
EVENT_DEPTH
Event depthstatic java.lang.String
EVENT_DEPTH_XML
XML for EVENT_DEPTHstatic java.lang.String
EVENT_DESCRIPTION
Event descriptionstatic java.lang.String
EVENT_DESCRIPTION_XML
XML for EVENT_DESCRIPTIONstatic java.lang.String
EVENT_ELEMENT
Element for eventstatic java.lang.String
EVENT_ELEMENT_XML
XML for EVENT_ELEMENTstatic java.lang.String
EVENT_ID
GSM Parameter when using a different network as a backupstatic java.lang.String
EVENT_ID_XML
XML for EVENT_IDstatic java.lang.String
EVENT_LATITUDE
Event latitudestatic java.lang.String
EVENT_LATITUDE_XML
XML for EVENT_LATITUDEstatic java.lang.String
EVENT_LONGITUDE
Event longitudestatic java.lang.String
EVENT_LONGITUDE_XML
XML for EVENT_LONGITUDEstatic java.lang.String
EVENT_MAGNITUDE
Event magnitudestatic java.lang.String
EVENT_MAGNITUDE_XML
XML for EVENT_MAGNITUDEstatic java.lang.String
EVENT_NETWORK
GSM Parameter when using a different network as a backupstatic java.lang.String
EVENT_NETWORK_XML
XML for EVENT_NETWORKstatic java.lang.String
EVENT_TIMESTAMP
Event timestampstatic java.lang.String
EVENT_TIMESTAMP_XML
XML for EVENT_TIMESTAMPstatic java.lang.String
GRIDDATA_ELEMENT
Element for Shakemap griddatastatic java.lang.String
GRIDSPEC_ELEMENT
Element for grid specificationstatic java.lang.String
GRIDSPEC_ELEMENT_XML
XML for GRIDSPEC_ELEMENTstatic java.lang.String
GRIDSPEC_LATMAX
gridspec latitude maxstatic java.lang.String
GRIDSPEC_LATMAX_XML
XML for GRIDSPEC_LATMAXstatic java.lang.String
GRIDSPEC_LATMIN
gridspec latitude minstatic java.lang.String
GRIDSPEC_LATMIN_XML
XML for GRIDSPEC_LATMINstatic java.lang.String
GRIDSPEC_LONMAX
gridspec longitude maxstatic java.lang.String
GRIDSPEC_LONMAX_XML
XML for GRIDSPEC_LONMAXstatic java.lang.String
GRIDSPEC_LONMIN
gridspec longitude minstatic java.lang.String
GRIDSPEC_LONMIN_XML
XML for GRIDSPEC_LONMINstatic java.lang.String
SHAKEMAPGRID_ELEMENT
Element for shakemap gridstatic java.lang.String
SHAKEMAPGRID_ELEMENT_XML
XML for SHAKEMAPGRID_ELEMENTstatic java.lang.String
SHAKEMAPGRID_EVENT_STATUS
Shakemap grid event/map statusstatic java.lang.String
SHAKEMAPGRID_EVENT_STATUS_XML
XML for SHAKEMAPGRID_EVENT_STATUSstatic java.lang.String
SHAKEMAPGRID_EVENT_TYPE
Shakemap grid event typestatic java.lang.String
SHAKEMAPGRID_EVENT_TYPE_XML
XML for SHAKEMAPGRID_EVENT_TYPEstatic java.lang.String
SHAKEMAPGRID_ID
Shakemap grid idstatic java.lang.String
SHAKEMAPGRID_ID_XML
XML for SHAKEMAPGRID_IDstatic java.lang.String
SHAKEMAPGRID_ORIGINATOR
Shakemap grid originatorstatic java.lang.String
SHAKEMAPGRID_ORIGINATOR_XML
XML for SHAKEMAPGRID_ORIGINATORstatic java.lang.String
SHAKEMAPGRID_TIMESTAMP
Shakemap grid process timestampstatic java.lang.String
SHAKEMAPGRID_TIMESTAMP_XML
XML for SHAKEMAPGRID_TIMESTAMPstatic java.lang.String
SHAKEMAPGRID_VERSION
Shakemap grid versionstatic java.lang.String
SHAKEMAPGRID_VERSION_XML
XML for SHAKEMAPGRID_VERSIONstatic java.lang.String
STOP_PARSING_BEFORE_GRIDDATA
Shakemap griddata parameter to stop parsing before
-
Constructor Summary
Constructors Constructor Description GridXMLHandler()
Construct a new SAX Handler for an grid.xml document.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.HashMap<java.lang.String,java.lang.String>
getInfo()
java.util.HashMap<java.lang.String,java.lang.String>
parse(java.lang.Object in)
void
startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes)
Read grid, event, and gridspec element attributes.-
Methods inherited from class org.xml.sax.helpers.DefaultHandler
characters, endDocument, endElement, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
-
-
-
-
Field Detail
-
SHAKEMAPGRID_ELEMENT
public static final java.lang.String SHAKEMAPGRID_ELEMENT
Element for shakemap grid- See Also:
- Constant Field Values
-
SHAKEMAPGRID_ID
public static final java.lang.String SHAKEMAPGRID_ID
Shakemap grid id- See Also:
- Constant Field Values
-
SHAKEMAPGRID_ORIGINATOR
public static final java.lang.String SHAKEMAPGRID_ORIGINATOR
Shakemap grid originator- See Also:
- Constant Field Values
-
SHAKEMAPGRID_TIMESTAMP
public static final java.lang.String SHAKEMAPGRID_TIMESTAMP
Shakemap grid process timestamp- See Also:
- Constant Field Values
-
SHAKEMAPGRID_VERSION
public static final java.lang.String SHAKEMAPGRID_VERSION
Shakemap grid version- See Also:
- Constant Field Values
-
SHAKEMAPGRID_EVENT_TYPE
public static final java.lang.String SHAKEMAPGRID_EVENT_TYPE
Shakemap grid event type- See Also:
- Constant Field Values
-
SHAKEMAPGRID_EVENT_STATUS
public static final java.lang.String SHAKEMAPGRID_EVENT_STATUS
Shakemap grid event/map status- See Also:
- Constant Field Values
-
EVENT_ELEMENT
public static final java.lang.String EVENT_ELEMENT
Element for event- See Also:
- Constant Field Values
-
EVENT_LATITUDE
public static final java.lang.String EVENT_LATITUDE
Event latitude- See Also:
- Constant Field Values
-
EVENT_LONGITUDE
public static final java.lang.String EVENT_LONGITUDE
Event longitude- See Also:
- Constant Field Values
-
EVENT_MAGNITUDE
public static final java.lang.String EVENT_MAGNITUDE
Event magnitude- See Also:
- Constant Field Values
-
EVENT_TIMESTAMP
public static final java.lang.String EVENT_TIMESTAMP
Event timestamp- See Also:
- Constant Field Values
-
EVENT_DESCRIPTION
public static final java.lang.String EVENT_DESCRIPTION
Event description- See Also:
- Constant Field Values
-
EVENT_DEPTH
public static final java.lang.String EVENT_DEPTH
Event depth- See Also:
- Constant Field Values
-
EVENT_NETWORK
public static final java.lang.String EVENT_NETWORK
GSM Parameter when using a different network as a backup- See Also:
- Constant Field Values
-
EVENT_ID
public static final java.lang.String EVENT_ID
GSM Parameter when using a different network as a backup- See Also:
- Constant Field Values
-
GRIDSPEC_ELEMENT
public static final java.lang.String GRIDSPEC_ELEMENT
Element for grid specification- See Also:
- Constant Field Values
-
GRIDSPEC_LONMIN
public static final java.lang.String GRIDSPEC_LONMIN
gridspec longitude min- See Also:
- Constant Field Values
-
GRIDSPEC_LONMAX
public static final java.lang.String GRIDSPEC_LONMAX
gridspec longitude max- See Also:
- Constant Field Values
-
GRIDSPEC_LATMIN
public static final java.lang.String GRIDSPEC_LATMIN
gridspec latitude min- See Also:
- Constant Field Values
-
GRIDSPEC_LATMAX
public static final java.lang.String GRIDSPEC_LATMAX
gridspec latitude max- See Also:
- Constant Field Values
-
SHAKEMAPGRID_ELEMENT_XML
public static final java.lang.String SHAKEMAPGRID_ELEMENT_XML
XML for SHAKEMAPGRID_ELEMENT- See Also:
- Constant Field Values
-
SHAKEMAPGRID_ID_XML
public static final java.lang.String SHAKEMAPGRID_ID_XML
XML for SHAKEMAPGRID_ID- See Also:
- Constant Field Values
-
SHAKEMAPGRID_ORIGINATOR_XML
public static final java.lang.String SHAKEMAPGRID_ORIGINATOR_XML
XML for SHAKEMAPGRID_ORIGINATOR- See Also:
- Constant Field Values
-
SHAKEMAPGRID_TIMESTAMP_XML
public static final java.lang.String SHAKEMAPGRID_TIMESTAMP_XML
XML for SHAKEMAPGRID_TIMESTAMP- See Also:
- Constant Field Values
-
SHAKEMAPGRID_VERSION_XML
public static final java.lang.String SHAKEMAPGRID_VERSION_XML
XML for SHAKEMAPGRID_VERSION- See Also:
- Constant Field Values
-
SHAKEMAPGRID_EVENT_TYPE_XML
public static final java.lang.String SHAKEMAPGRID_EVENT_TYPE_XML
XML for SHAKEMAPGRID_EVENT_TYPE- See Also:
- Constant Field Values
-
SHAKEMAPGRID_EVENT_STATUS_XML
public static final java.lang.String SHAKEMAPGRID_EVENT_STATUS_XML
XML for SHAKEMAPGRID_EVENT_STATUS- See Also:
- Constant Field Values
-
EVENT_ELEMENT_XML
public static final java.lang.String EVENT_ELEMENT_XML
XML for EVENT_ELEMENT- See Also:
- Constant Field Values
-
EVENT_LATITUDE_XML
public static final java.lang.String EVENT_LATITUDE_XML
XML for EVENT_LATITUDE- See Also:
- Constant Field Values
-
EVENT_LONGITUDE_XML
public static final java.lang.String EVENT_LONGITUDE_XML
XML for EVENT_LONGITUDE- See Also:
- Constant Field Values
-
EVENT_MAGNITUDE_XML
public static final java.lang.String EVENT_MAGNITUDE_XML
XML for EVENT_MAGNITUDE- See Also:
- Constant Field Values
-
EVENT_TIMESTAMP_XML
public static final java.lang.String EVENT_TIMESTAMP_XML
XML for EVENT_TIMESTAMP- See Also:
- Constant Field Values
-
EVENT_DESCRIPTION_XML
public static final java.lang.String EVENT_DESCRIPTION_XML
XML for EVENT_DESCRIPTION- See Also:
- Constant Field Values
-
EVENT_DEPTH_XML
public static final java.lang.String EVENT_DEPTH_XML
XML for EVENT_DEPTH- See Also:
- Constant Field Values
-
EVENT_NETWORK_XML
public static final java.lang.String EVENT_NETWORK_XML
XML for EVENT_NETWORK- See Also:
- Constant Field Values
-
EVENT_ID_XML
public static final java.lang.String EVENT_ID_XML
XML for EVENT_ID- See Also:
- Constant Field Values
-
GRIDSPEC_ELEMENT_XML
public static final java.lang.String GRIDSPEC_ELEMENT_XML
XML for GRIDSPEC_ELEMENT- See Also:
- Constant Field Values
-
GRIDSPEC_LONMIN_XML
public static final java.lang.String GRIDSPEC_LONMIN_XML
XML for GRIDSPEC_LONMIN- See Also:
- Constant Field Values
-
GRIDSPEC_LONMAX_XML
public static final java.lang.String GRIDSPEC_LONMAX_XML
XML for GRIDSPEC_LONMAX- See Also:
- Constant Field Values
-
GRIDSPEC_LATMIN_XML
public static final java.lang.String GRIDSPEC_LATMIN_XML
XML for GRIDSPEC_LATMIN- See Also:
- Constant Field Values
-
GRIDSPEC_LATMAX_XML
public static final java.lang.String GRIDSPEC_LATMAX_XML
XML for GRIDSPEC_LATMAX- See Also:
- Constant Field Values
-
GRIDDATA_ELEMENT
public static final java.lang.String GRIDDATA_ELEMENT
Element for Shakemap griddata- See Also:
- Constant Field Values
-
STOP_PARSING_BEFORE_GRIDDATA
public static final java.lang.String STOP_PARSING_BEFORE_GRIDDATA
Shakemap griddata parameter to stop parsing before- See Also:
- Constant Field Values
-
-
Method Detail
-
parse
public java.util.HashMap<java.lang.String,java.lang.String> parse(java.lang.Object in) throws java.lang.Exception
- Parameters:
in
- - the file or stream to parse- Returns:
- the ShakeMap associated with this XML handler
- Throws:
java.lang.Exception
- if error occurs
-
getInfo
public java.util.HashMap<java.lang.String,java.lang.String> getInfo()
- Returns:
- the parsed info.
-
startElement
public final void startElement(java.lang.String uri, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attributes) throws org.xml.sax.SAXException
Read grid, event, and gridspec element attributes.- Specified by:
startElement
in interfaceorg.xml.sax.ContentHandler
- Overrides:
startElement
in classorg.xml.sax.helpers.DefaultHandler
- Parameters:
uri
- namespace of element.localName
- name of element.qName
- qualified name of element.attributes
- element attributes.- Throws:
org.xml.sax.SAXException
- when griddata element is reached, to stop parsing.
-
-