Home Original page

StringElementHandlerBase (biojava-legacy 1.9.5 API)

  • java.lang.Object
    • org.biojava.utils.stax.StAXContentHandlerBase
      • org.biojava.utils.stax.StringElementHandlerBase
  • All Implemented Interfaces:
    StAXContentHandler
    Direct Known Subclasses:
    GAMEDescriptionPropHandler, GAMENamePropHandler, GAMETypePropHandler, PropDetailHandler

    public abstract class StringElementHandlerBase
    extends StAXContentHandlerBase

    StAX handler for any element which just contains a string. This class collects the string data, and when it is complete, passes it to the (abstract) setStringValue method. Typical use of this class is as a base for a small (often anonymous) class which takes the string value and stores it in some variable.

    Since:
    1.2
    Author:
    Thomas Down, Greg Cox
    • Constructor Summary

      Constructors 
      Constructor Description
      StringElementHandlerBase()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void characters​(char[] ch, int start, int length)

      Signal a span of character data in the XML input.

      void endElement​(String nsURI, String localName, String qName, StAXContentHandler handler)  
      protected abstract void setStringValue​(String s)

      Override this method to do something useful with the string we collect.

      void startElement​(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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • StringElementHandlerBase

        public StringElementHandlerBase()
    • Method Detail

      • startElement

        public void startElement​(String nsURI,
                                 String localName,
                                 String qName,
                                 Attributes attrs,
                                 DelegationManager dm)
                          throws SAXException
        Specified by:
        startElement in interface StAXContentHandler
        Overrides:
        startElement in class StAXContentHandlerBase
        Throws:
        SAXException
      • endElement

        public void endElement​(String nsURI,
                               String localName,
                               String qName,
                               StAXContentHandler handler)
                        throws SAXException
        Specified by:
        endElement in interface StAXContentHandler
        Overrides:
        endElement in class StAXContentHandlerBase
        Throws:
        SAXException
      • characters

        public void characters​(char[] ch,
                               int start,
                               int length)
                        throws SAXException

        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.
        length - number of characters significant to this event.
        Throws:
        SAXException
      • setStringValue

        protected abstract void setStringValue​(String s)
                                        throws SAXException

        Override this method to do something useful with the string we collect. Maybe we should do this by delegation rather than extension.

        Throws:
        SAXException