org.crosswire.common.xml

## Class SerializingContentHandler

- java.lang.Object
- - org.crosswire.common.xml.SerializingContentHandler

- All Implemented Interfaces:
    ContentHandler

      public class SerializingContentHandler
      extends Object
      implements ContentHandler

  Class to convert a SAX stream into a simple String.
  Author:
    Joe Walker
  See Also:
    `The GNU Lesser General Public License for details.`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private StringBuilder` | `buffer`
    `private boolean` | `newlines`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SerializingContentHandler()` Default ctor that does not insert newlines.
    `SerializingContentHandler(boolean newlines)` Default ctor that conditionally inserts newlines.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `characters(char[] chars, int start, int length)`
    `void` | `endDocument()`
    `void` | `endElement(String uri, String localname, String qname)`
    `void` | `endPrefixMapping(String prefix)`
    `void` | `ignorableWhitespace(char[] chars, int start, int length)`
    `void` | `processingInstruction(String target, String data)`
    `void` | `setDocumentLocator(Locator locator)`
    `void` | `skippedEntity(String name)`
    `void` | `startDocument()`
    `void` | `startElement(String uri, String localname, String qname, Attributes attrs)`
    `void` | `startPrefixMapping(String prefix, String uri)`
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### newlines

          private boolean newlines

    - #### buffer

          private StringBuilder buffer

  - ### Constructor Detail

    - #### SerializingContentHandler

          public SerializingContentHandler()

      Default ctor that does not insert newlines.

    - #### SerializingContentHandler

          public SerializingContentHandler(boolean newlines)

      Default ctor that conditionally inserts newlines.
      Parameters:
        `newlines` - whether newlines are desired

  - ### Method Detail

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### setDocumentLocator

          public void setDocumentLocator(Locator locator)

      Specified by:
        `setDocumentLocator` in interface `ContentHandler`

    - #### startDocument

          public void startDocument()

      Specified by:
        `startDocument` in interface `ContentHandler`

    - #### endDocument

          public void endDocument()

      Specified by:
        `endDocument` in interface `ContentHandler`

    - #### startPrefixMapping

          public void startPrefixMapping(String prefix,
                                String uri)

      Specified by:
        `startPrefixMapping` in interface `ContentHandler`

    - #### endPrefixMapping

          public void endPrefixMapping(String prefix)

      Specified by:
        `endPrefixMapping` in interface `ContentHandler`

    - #### startElement

          public void startElement(String uri,
                          String localname,
                          String qname,
                          Attributes attrs)

      Specified by:
        `startElement` in interface `ContentHandler`

    - #### endElement

          public void endElement(String uri,
                        String localname,
                        String qname)

      Specified by:
        `endElement` in interface `ContentHandler`

    - #### characters

          public void characters(char[] chars,
                        int start,
                        int length)

      Specified by:
        `characters` in interface `ContentHandler`

    - #### ignorableWhitespace

          public void ignorableWhitespace(char[] chars,
                                 int start,
                                 int length)

      Specified by:
        `ignorableWhitespace` in interface `ContentHandler`

    - #### processingInstruction

          public void processingInstruction(String target,
                                   String data)

      Specified by:
        `processingInstruction` in interface `ContentHandler`

    - #### skippedEntity

          public void skippedEntity(String name)

      Specified by:
        `skippedEntity` in interface `ContentHandler`