Class ItemHandler

  • All Implemented Interfaces:
    DatasetTags, org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

    public class ItemHandler
    extends org.xml.sax.helpers.DefaultHandler
    implements DatasetTags
    A handler for reading key-value items.
    • Constructor Summary

      Constructors 
      Constructor Description
      ItemHandler​(RootHandler root, org.xml.sax.helpers.DefaultHandler parent)
      Creates a new item handler.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void endElement​(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
      The end of an element.
      java.lang.Comparable getKey()
      Returns the key that has been read by the handler, or null.
      java.lang.Number getValue()
      Returns the key that has been read by the handler, or null.
      void setKey​(java.lang.Comparable key)
      Sets the key.
      void setValue​(java.lang.Number value)
      Sets the value.
      void startElement​(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)
      The start of an element.
      • Methods inherited from class org.xml.sax.helpers.DefaultHandler

        characters, 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
    • Field Detail

      • parent

        private org.xml.sax.helpers.DefaultHandler parent
        The parent handler (can be the same as root, but not always).
      • key

        private java.lang.Comparable key
        The key.
      • value

        private java.lang.Number value
        The value.
    • Constructor Detail

      • ItemHandler

        public ItemHandler​(RootHandler root,
                           org.xml.sax.helpers.DefaultHandler parent)
        Creates a new item handler.
        Parameters:
        root - the root handler.
        parent - the parent handler.
    • Method Detail

      • getKey

        public java.lang.Comparable getKey()
        Returns the key that has been read by the handler, or null.
        Returns:
        The key.
      • setKey

        public void setKey​(java.lang.Comparable key)
        Sets the key.
        Parameters:
        key - the key.
      • getValue

        public java.lang.Number getValue()
        Returns the key that has been read by the handler, or null.
        Returns:
        The value.
      • setValue

        public void setValue​(java.lang.Number value)
        Sets the value.
        Parameters:
        value - the value.
      • startElement

        public void startElement​(java.lang.String namespaceURI,
                                 java.lang.String localName,
                                 java.lang.String qName,
                                 org.xml.sax.Attributes atts)
                          throws org.xml.sax.SAXException
        The start of an element.
        Specified by:
        startElement in interface org.xml.sax.ContentHandler
        Overrides:
        startElement in class org.xml.sax.helpers.DefaultHandler
        Parameters:
        namespaceURI - the namespace.
        localName - the element name.
        qName - the element name.
        atts - the attributes.
        Throws:
        org.xml.sax.SAXException - for errors.
      • endElement

        public void endElement​(java.lang.String namespaceURI,
                               java.lang.String localName,
                               java.lang.String qName)
        The end of an element.
        Specified by:
        endElement in interface org.xml.sax.ContentHandler
        Overrides:
        endElement in class org.xml.sax.helpers.DefaultHandler
        Parameters:
        namespaceURI - the namespace.
        localName - the element name.
        qName - the element name.