Class DoubleElementHandlerBase

  • All Implemented Interfaces:
    StAXContentHandler

    public abstract class DoubleElementHandlerBase
    extends StAXContentHandlerBase

    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 Detail

      • DoubleElementHandlerBase

        public DoubleElementHandlerBase()
    • Method Detail

      • characters

        public void characters​(char[] ch,
                               int start,
                               int end)
                        throws org.xml.sax.SAXException
        Description copied from class: StAXContentHandlerBase
        Signal a span of character data in the XML input.
        Specified by:
        characters in interface StAXContentHandler
        Overrides:
        characters in class StAXContentHandlerBase
        Parameters:
        ch - an array of characters
        start - index of the first significant character for this event.
        end - number of characters significant to this event.
        Throws:
        org.xml.sax.SAXException
      • setDoubleValue

        protected abstract void setDoubleValue​(double val)
                                        throws org.xml.sax.SAXException

        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:
        org.xml.sax.SAXException - if for any reason the double is not palatable