Package org.apache.torque.generator.source.stream

## Class XmlSourceSaxHandler

- java.lang.Object
- - org.xml.sax.helpers.DefaultHandler
  - - org.apache.torque.generator.source.stream.XmlSourceSaxHandler

- All Implemented Interfaces:
    `ContentHandler`, `DTDHandler`, `EntityResolver`, `ErrorHandler`

      public class XmlSourceSaxHandler
      extends DefaultHandler

  A SAX Handler for creating a source element tree from xml.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `XmlSourceSaxHandler​(EntityReferences entityReferences)` | Constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `characters​(char[] ch, int start, int length)` |
    `void` | `endElement​(String uri, String localName, String qName)` |
    `void` | `error​(SAXParseException exception)` |
    `void` | `fatalError​(SAXParseException exception)` |
    `SourceElement` | `getRoot()` | Returns the root element of the tree.
    `void` | `ignorableWhitespace​(char[] ch, int start, int length)` |
    `InputSource` | `resolveEntity​(String publicId, String systemId)` | EntityResolver implementation.
    `void` | `startElement​(String uri, String localName, String qName, Attributes attributes)` |
    `void` | `warning​(SAXParseException exception)` |

    - ### Methods inherited from class org.xml.sax.helpers.DefaultHandler

      `endDocument, endPrefixMapping, notationDecl, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl`

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

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

- - ### Constructor Detail

    - #### XmlSourceSaxHandler

          public XmlSourceSaxHandler​(EntityReferences entityReferences)

      Constructor.
      Parameters:
        `entityReferences` - the known entity references, not null.

  - ### Method Detail

    - #### startElement

          public void startElement​(String uri,
                                   String localName,
                                   String qName,
                                   Attributes attributes)
                            throws SAXException

      Specified by:
        `startElement` in interface `ContentHandler`
      Overrides:
        `startElement` in class `DefaultHandler`
      Throws:
        `SAXException`

    - #### endElement

          public void endElement​(String uri,
                                 String localName,
                                 String qName)
                          throws SAXException

      Specified by:
        `endElement` in interface `ContentHandler`
      Overrides:
        `endElement` in class `DefaultHandler`
      Throws:
        `SAXException`

    - #### characters

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

      Specified by:
        `characters` in interface `ContentHandler`
      Overrides:
        `characters` in class `DefaultHandler`
      Throws:
        `SAXException`

    - #### ignorableWhitespace

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

      Specified by:
        `ignorableWhitespace` in interface `ContentHandler`
      Overrides:
        `ignorableWhitespace` in class `DefaultHandler`
      Throws:
        `SAXException`

    - #### resolveEntity

          public InputSource resolveEntity​(String publicId,
                                           String systemId)
                                    throws SAXException,
                                           IOException

      EntityResolver implementation. Called by the XML parser
      Specified by:
        `resolveEntity` in interface `EntityResolver`
      Overrides:
        `resolveEntity` in class `DefaultHandler`
      Parameters:
        `publicId` - The public identifier of the external entity.
        `systemId` - The system identifier of the external entity.
      Returns:
        an InputSource for the entity, or null if the URI is not known.
      Throws:
        `SAXException`
        `IOException`
      See Also:
        `ConfigurationEntityResolver.resolveEntity(String, String)`

    - #### getRoot

          public SourceElement getRoot()

      Returns the root element of the tree.
      Returns:
        the root element (may be null if no elements were in the xml) or null if the xml was not yet parsed.

    - #### error

          public void error​(SAXParseException exception)
                     throws SAXParseException

      Specified by:
        `error` in interface `ErrorHandler`
      Overrides:
        `error` in class `DefaultHandler`
      Throws:
        `SAXParseException`

    - #### fatalError

          public void fatalError​(SAXParseException exception)
                          throws SAXParseException

      Specified by:
        `fatalError` in interface `ErrorHandler`
      Overrides:
        `fatalError` in class `DefaultHandler`
      Throws:
        `SAXParseException`

    - #### warning

          public void warning​(SAXParseException exception)
                       throws SAXParseException

      Specified by:
        `warning` in interface `ErrorHandler`
      Overrides:
        `warning` in class `DefaultHandler`
      Throws:
        `SAXParseException`