## org.biojava.utils.stax
Class CharElementHandlerBase

    java.lang.Object
      org.biojava.utils.stax.StAXContentHandlerBase
          org.biojava.utils.stax.CharElementHandlerBase

All Implemented Interfaces:
  StAXContentHandler

public abstract class CharElementHandlerBase
extends StAXContentHandlerBase

StAX handler for any element which just contains a string representation of a char.

This calss collects the string data, and when it is complete, passes it to the (abstract) setCharValue method. Typical use of this class is as a base for a small (often anonymous) class which takes the char value and stores it in some variable.

Since:
  1.2
Author:
  Matthew Pocock

Constructor Summary
`CharElementHandlerBase()`

Method Summary
`void` `characters(char[] ch, int start, int end)` Signal a span of character data in the XML input.
`void` `endElement(java.lang.String nsURI, java.lang.String localName, java.lang.String qName, StAXContentHandler handler)`
`protected abstract void` `setCharValue(char val)` Override this method to do something useful with the char we collect.
`void` `startElement(java.lang.String nsURI, java.lang.String localName, java.lang.String qName, org.xml.sax.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

### CharElementHandlerBase

    public CharElementHandlerBase()

Method Detail

### startElement

    public void startElement(java.lang.String nsURI,
                             java.lang.String localName,
                             java.lang.String qName,
                             org.xml.sax.Attributes attrs,
                             DelegationManager dm)
                      throws org.xml.sax.SAXException

  Specified by:
    `startElement` in interface `StAXContentHandler`
  Overrides:
    `startElement` in class `StAXContentHandlerBase`
  Throws:
    `org.xml.sax.SAXException`

### endElement

    public void endElement(java.lang.String nsURI,
                           java.lang.String localName,
                           java.lang.String qName,
                           StAXContentHandler handler)
                    throws org.xml.sax.SAXException

  Specified by:
    `endElement` in interface `StAXContentHandler`
  Overrides:
    `endElement` in class `StAXContentHandlerBase`
  Throws:
    `org.xml.sax.SAXException`

### 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`

### setCharValue

    protected abstract void setCharValue(char val)
                                  throws org.xml.sax.SAXException

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

  This method will be invoked by endElement with the fully parsed char.

  Throws:
    `org.xml.sax.SAXException` - if for any reason the char is not palatable