Package org.biojava.utils.stax
Class DoubleElementHandlerBase
java.lang.Object
org.biojava.utils.stax.StAXContentHandlerBase
org.biojava.utils.stax.DoubleElementHandlerBase
- All Implemented Interfaces:
StAXContentHandler
StAX handler for any element which just contains a string representation of a double.
This calss collects the string data, and when it is complete, passes it to the (abstract) setDoubleValue method. Typical use of this class is as a base for a small (often anonymous) class which takes the double value and stores it in some variable.
- Since:
- 1.2
- Author:
- Matthew Pocock, Greg Cox
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcharacters(char[] ch, int start, int end) Signal a span of character data in the XML input.voidendElement(String nsURI, String localName, String qName, StAXContentHandler handler) protected abstract voidsetDoubleValue(double val) Override this method to do something useful with the double we collect.voidstartElement(String nsURI, String localName, String qName, Attributes attrs, DelegationManager dm) Methods inherited from class org.biojava.utils.stax.StAXContentHandlerBase
endPrefixMapping, endTree, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startPrefixMapping, startTree
-
Constructor Details
-
DoubleElementHandlerBase
public DoubleElementHandlerBase()
-
-
Method Details
-
startElement
public void startElement(String nsURI, String localName, String qName, Attributes attrs, DelegationManager dm) throws SAXException - Specified by:
startElementin interfaceStAXContentHandler- Overrides:
startElementin classStAXContentHandlerBase- Throws:
SAXException
-
endElement
public void endElement(String nsURI, String localName, String qName, StAXContentHandler handler) throws SAXException - Specified by:
endElementin interfaceStAXContentHandler- Overrides:
endElementin classStAXContentHandlerBase- Throws:
SAXException
-
characters
Description copied from class:StAXContentHandlerBaseSignal a span of character data in the XML input.- Specified by:
charactersin interfaceStAXContentHandler- Overrides:
charactersin classStAXContentHandlerBase- Parameters:
ch- an array of charactersstart- index of the first significant character for this event.end- number of characters significant to this event.- Throws:
SAXException
-
setDoubleValue
Override this method to do something useful with the double we collect.
This method will be invoked by endElement with the fully parsed double.
- Parameters:
val- the fully parsed double- Throws:
SAXException- if for any reason the double is not palatable
-