org.apache.fop.util

## Class GenerationHelperContentHandler

- java.lang.Object
- - org.apache.fop.util.DelegatingContentHandler
  - - org.apache.fop.util.GenerationHelperContentHandler

All Implemented Interfaces:
  ContentHandler, DTDHandler, EntityResolver, ErrorHandler, LexicalHandler

    public class GenerationHelperContentHandler
    extends DelegatingContentHandler

This class is a delegating SAX ContentHandler which has the purpose to provide a few handy methods that make life easier when generating SAX events.

### Constructor Summary

Constructors
Constructor and Description
`GenerationHelperContentHandler(ContentHandler handler, String mainNamespace, Object contentHandlerContext)` Main constructor.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `element(org.apache.xmlgraphics.util.QName qName, Attributes atts)` Convenience method to generate an empty element with attributes.
`void` `element(String localName, Attributes atts)` Convenience method to generate an empty element with attributes.
`void` `endElement(org.apache.xmlgraphics.util.QName qName)` Convenience method to generate a startElement SAX event.
`void` `endElement(String localName)` Convenience method to generate a endElement SAX event.
`Object` `getContentHandlerContext()` Returns the context object (may be null).
`String` `getMainNamespace()` Returns the main namespace used for generated XML content.
`void` `setMainNamespace(String namespaceURI)` Sets the main namespace used for generated XML content when abbreviated ContentHandler calls are used.
`void` `startElement(org.apache.xmlgraphics.util.QName qName)` Convenience method to generate a startElement SAX event.
`void` `startElement(org.apache.xmlgraphics.util.QName qName, Attributes atts)` Convenience method to generate a startElement SAX event.
`void` `startElement(String localName)` Convenience method to generate a startElement SAX event.
`void` `startElement(String localName, Attributes atts)` Convenience method to generate a startElement SAX event.

### Methods inherited from class org.apache.fop.util.DelegatingContentHandler

`characters, comment, endCDATA, endDocument, endDTD, endElement, endEntity, endPrefixMapping, error, fatalError, getDelegateContentHandler, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDelegateContentHandler, setDelegateDTDHandler, setDelegateEntityResolver, setDelegateErrorHandler, setDelegateLexicalHandler, setDocumentLocator, skippedEntity, startCDATA, startDocument, startDTD, startElement, startEntity, startPrefixMapping, unparsedEntityDecl, warning`

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

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

### Constructor Detail

#### GenerationHelperContentHandler

    public GenerationHelperContentHandler(ContentHandler handler,
                                          String mainNamespace,
                                          Object contentHandlerContext)

Main constructor. If the given handler also implements any of the EntityResolver, DTDHandler, LexicalHandler or ErrorHandler interfaces, these are set automatically.

Parameters:
  `handler` - the SAX content handler to delegate all calls to
  `mainNamespace` - the main namespace used for generated XML content when abbreviated ContentHandler calls are used.
  `contentHandlerContext` - additional content handler context state

### Method Detail

#### getMainNamespace

    public String getMainNamespace()

Returns the main namespace used for generated XML content.

Returns:
  the main namespace

#### setMainNamespace

    public void setMainNamespace(String namespaceURI)

Sets the main namespace used for generated XML content when abbreviated ContentHandler calls are used.

Parameters:
  `namespaceURI` - the new main namespace URI

#### getContentHandlerContext

    public Object getContentHandlerContext()

Returns the context object (may be null).

Returns:
  the context object

#### startElement

    public void startElement(String localName,
                             Attributes atts)
                      throws SAXException

Convenience method to generate a startElement SAX event.

Parameters:
  `localName` - the local name of the element
  `atts` - the attributes
Throws:
  `SAXException` - if a SAX exception occurs

#### startElement

    public void startElement(String localName)
                      throws SAXException

Convenience method to generate a startElement SAX event.

Parameters:
  `localName` - the local name of the element
Throws:
  `SAXException` - if a SAX exception occurs

#### startElement

    public void startElement(org.apache.xmlgraphics.util.QName qName,
                             Attributes atts)
                      throws SAXException

Convenience method to generate a startElement SAX event.

Parameters:
  `qName` - the qualified name of the element
  `atts` - the attributes
Throws:
  `SAXException` - if a SAX exception occurs

#### startElement

    public void startElement(org.apache.xmlgraphics.util.QName qName)
                      throws SAXException

Convenience method to generate a startElement SAX event.

Parameters:
  `qName` - the qualified name of the element
Throws:
  `SAXException` - if a SAX exception occurs

#### endElement

    public void endElement(String localName)
                    throws SAXException

Convenience method to generate a endElement SAX event.

Parameters:
  `localName` - the local name of the element
Throws:
  `SAXException` - if a SAX exception occurs

#### endElement

    public void endElement(org.apache.xmlgraphics.util.QName qName)
                    throws SAXException

Convenience method to generate a startElement SAX event.

Parameters:
  `qName` - the qualified name of the element
Throws:
  `SAXException` - if a SAX exception occurs

#### element

    public void element(String localName,
                        Attributes atts)
                 throws SAXException

Convenience method to generate an empty element with attributes.

Parameters:
  `localName` - the local name of the element
  `atts` - the attributes
Throws:
  `SAXException` - if a SAX exception occurs

#### element

    public void element(org.apache.xmlgraphics.util.QName qName,
                        Attributes atts)
                 throws SAXException

Convenience method to generate an empty element with attributes.

Parameters:
  `qName` - the qualified name of the element
  `atts` - the attributes
Throws:
  `SAXException` - if a SAX exception occurs