Package edu.sc.seis.seisFile.fdsnws
Class StaxUtil
java.lang.Object
edu.sc.seis.seisFile.fdsnws.StaxUtil
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StartElement
expectStartElement
(String expected, XMLEventReader reader) static boolean
hasAttribute
(StartElement start, String name) static boolean
hasNext
(XMLEventReader reader, String elementName, String endElementName) Checks for a next element of name "elementName".static boolean
hasNext
(XMLEventReader reader, String elementName, String endElementName, StaxElementProcessor unknownProcessor) static Instant
static String
pullAttribute
(StartElement start, String name) static String
pullAttributeIfExists
(StartElement start, String name) static String
pullContiguousText
(XMLEventReader reader) static Instant
pullDate
(XMLEventReader reader, String name) static Instant
pullDateAttributeIfExists
(StartElement start, String name) extracts a Instant from the named attribute.static float
pullFloat
(XMLEventReader reader, String elementName) static Float
pullFloatAttribute
(StartElement start, String name) static int
pullInt
(XMLEventReader reader, String elementName) static Integer
pullIntAttribute
(StartElement start, String name) static String
pullText
(XMLEventReader reader, String elementName) static void
skipToMatchingEnd
(XMLEventReader reader) static void
skipToStartElement
(XMLEventReader reader) static void
-
Field Details
-
DATE_FORMAT
- See Also:
-
SHORT_DATE_FORMAT
- See Also:
-
-
Constructor Details
-
StaxUtil
public StaxUtil()
-
-
Method Details
-
expectStartElement
public static StartElement expectStartElement(String expected, XMLEventReader reader) throws XMLStreamException, StationXMLException -
pullContiguousText
public static String pullContiguousText(XMLEventReader reader) throws XMLStreamException, StationXMLException -
pullText
public static String pullText(XMLEventReader reader, String elementName) throws XMLStreamException, StationXMLException -
pullInt
public static int pullInt(XMLEventReader reader, String elementName) throws NumberFormatException, XMLStreamException, StationXMLException -
pullFloat
public static float pullFloat(XMLEventReader reader, String elementName) throws NumberFormatException, XMLStreamException, StationXMLException -
skipToStartElement
- Throws:
XMLStreamException
-
skipToMatchingEnd
- Throws:
XMLStreamException
-
skipToStartOrEndElement
- Throws:
XMLStreamException
-
hasNext
public static boolean hasNext(XMLEventReader reader, String elementName, String endElementName) throws XMLStreamException Checks for a next element of name "elementName". Skips over any other elements so long as it doesn't hit an element of name "endElementName. This is so we don't return stations from the next network when passing a ending network tag.- Parameters:
reader
-elementName
- element name we are looking forendElementName
- end element name to not go past, ie the parent element- Returns:
- true if there is another element, false otherwise
- Throws:
XMLStreamException
-
hasNext
public static boolean hasNext(XMLEventReader reader, String elementName, String endElementName, StaxElementProcessor unknownProcessor) throws XMLStreamException, SeisFileException - Throws:
XMLStreamException
SeisFileException
-
hasAttribute
-
pullAttributeIfExists
public static String pullAttributeIfExists(StartElement start, String name) throws StationXMLException - Throws:
StationXMLException
-
pullAttribute
- Throws:
StationXMLException
-
pullIntAttribute
- Throws:
StationXMLException
-
pullFloatAttribute
- Throws:
StationXMLException
-
pullDate
public static Instant pullDate(XMLEventReader reader, String name) throws StationXMLException, XMLStreamException -
pullDateAttributeIfExists
public static Instant pullDateAttributeIfExists(StartElement start, String name) throws StationXMLException extracts a Instant from the named attribute. Null if the attribute is not found.- Throws:
StationXMLException
-
parseDate
- Throws:
StationXMLException
-