Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cocoon.stax.converter.util
Class StAXEventContentHandler

    java.lang.Object
      org.xml.sax.helpers.DefaultHandler
          org.apache.cocoon.stax.converter.util.StAXEventContentHandler

All Implemented Interfaces:
  Consumer, PipelineComponent, SAXConsumer, ContentHandler, DTDHandler, EntityResolver, ErrorHandler, LexicalHandler

    public class StAXEventContentHandler

extends DefaultHandler
implements SAXConsumer

SAX ContentHandler that writes events to a StAX `XMLEventConsumer`.

Version:
  $Revision: 1.5 $, from stax-utils stable version stax-utils-20070216

Constructor Summary
`StAXEventContentHandler()` Constructs a default instance with a default event factory.
`StAXEventContentHandler(XMLEventConsumer consumer)` Constructs an instance that writes events to the provided XMLEventConsumer.
`StAXEventContentHandler(XMLEventConsumer consumer, XMLEventFactory factory)` Constructs an instance that writes events constructed with the provided XMLEventFactory to the provided XMLEventConsumer

Method Summary
`void` | `characters(char[] ch, int start, int length)`
`void` | `comment(char[] ch, int start, int length)`
`protected Namespace` | `createNamespace(String prefix, String uri)`
`protected void` | `createStartEvents(Attributes attributes, Collection[] events)` Creates the `Namespace`and `Attribute`events associated with a `StartElement`.
`void` | `endCDATA()`
`void` | `endDocument()`
`void` | `endDTD()`
`void` | `endElement(String uri, String localName, String qName)`
`void` | `endEntity(String name)`
`void` | `endPrefixMapping(String prefix)`
`void` | `error(SAXParseException e)`
`void` | `fatalError(SAXParseException e)`
`void` | `finish()` This method is called after pipeline run - regardless if the run was successful or an exception was thrown.
`Location` | `getCurrentLocation()` Calculates the STAX `Location`from the SAX `Locator` registered with this handler.
`XMLEventConsumer` | `getEventConsumer()` Returns a reference to the `XMLEventConsumer` to which events will be written.
`XMLEventFactory` | `getEventFactory()` Returns a reference to the `XMLEventFactory` used to construct events.
`void` | `ignorableWhitespace(char[] ch, int start, int length)`
`void` | `processingInstruction(String target, String data)`
`protected void` | `reportException(String type, SAXException e)` Used to report a `SAXException`to the `XMLReporter` registered with this handler.
`void` | `setConfiguration(Map<String,? extends Object> configuration)` Pass component specific configuration parameters to the pipeline component in a generic way.
`void` | `setDocumentLocator(Locator locator)`
`void` | `setEventConsumer(XMLEventConsumer consumer)` Sets the `XMLEventConsumer` to which events are written.
`void` | `setEventFactory(XMLEventFactory factory)` Sets the `XMLEventFactory` used to create events.
`void` | `setup(Map<String,Object> parameters)` The shared object map for this pipeline run.
`void` | `setXMLReporter(XMLReporter reporter)` Sets the `XMLReporter`to which warning and error messages will be sent.
`void` | `startCDATA()`
`void` | `startDocument()`
`void` | `startDTD(String name, String publicId, String systemId)`
`void` | `startElement(String uri, String localName, String qName, Attributes attributes)`
`void` | `startEntity(String name)`
`void` | `startPrefixMapping(String prefix, String uri)`
`void` | `warning(SAXParseException e)`

Methods inherited from class org.xml.sax.helpers.DefaultHandler
`notationDecl, resolveEntity, skippedEntity, unparsedEntityDecl`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.xml.sax.ContentHandler
`skippedEntity`

Constructor Detail

### StAXEventContentHandler

    public StAXEventContentHandler()

  Constructs a default instance with a default event factory. You must set the `XMLEventConsumer`via the `setEventConsumer(XMLEventConsumer)`method.

### StAXEventContentHandler

    public StAXEventContentHandler(XMLEventConsumer consumer)

  Constructs an instance that writes events to the provided XMLEventConsumer. Events will be constructed from a default XMLEventFactory instance.

  Parameters:
    `consumer` - The `XMLEventConsumer`to which events will be written.

### StAXEventContentHandler

    public StAXEventContentHandler(XMLEventConsumer consumer,
                                   XMLEventFactory factory)

  Constructs an instance that writes events constructed with the provided XMLEventFactory to the provided XMLEventConsumer

  Parameters:
    `consumer` - The `XMLEventConsumer` to which events will be written.
    `factory` - The `XMLEventFactory` used to construct events. If `null`, a default instance will be constructed.

Method Detail

### getEventConsumer

    public XMLEventConsumer getEventConsumer()

  Returns a reference to the `XMLEventConsumer` to which events will be written.

  Returns:
    The `XMLEventConsumer` to which events will be written.

### setEventConsumer

    public void setEventConsumer(XMLEventConsumer consumer)

  Sets the `XMLEventConsumer` to which events are written.

  Parameters:
    `consumer` - The `XMLEventConsumer` to which events will be written.

### getEventFactory

    public XMLEventFactory getEventFactory()

  Returns a reference to the `XMLEventFactory` used to construct events.

  Returns:
    The `XMLEventFactory` used to construct events.

### setEventFactory

    public void setEventFactory(XMLEventFactory factory)

  Sets the `XMLEventFactory` used to create events.

  Parameters:
    `factory` - The `XMLEventFactory` used to create events.

### startDocument

    public void startDocument()
                       throws SAXException

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

### endDocument

    public void endDocument()
                     throws SAXException

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

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

### comment

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

  Specified by:
    `comment` in interface `LexicalHandler`
  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`

### processingInstruction

    public void processingInstruction(String target,
                                      String data)
                               throws SAXException

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

### endCDATA

    public void endCDATA()
                  throws SAXException

  Specified by:
    `endCDATA` in interface `LexicalHandler`
  Throws:
    `SAXException`

### createStartEvents

    protected void createStartEvents(Attributes attributes,
                                     Collection[] events)

  Creates the `Namespace`and `Attribute`events associated with a `StartElement`.

  Parameters:
    `attributes` - The SAX attributes object.
    `events` - An array used to return the two collections of `Namespace`and `Attribute`events. The namespaces will be placed at `events[0]` and the attributes as `events[1]`.

### createNamespace

    protected Namespace createNamespace(String prefix,
                                        String uri)

### setXMLReporter

    public void setXMLReporter(XMLReporter reporter)

  Sets the `XMLReporter`to which warning and error messages will be sent.

  Parameters:
    `reporter` - The `XMLReporter`to notify of errors.

### setDocumentLocator

    public void setDocumentLocator(Locator locator)

  Specified by:
    `setDocumentLocator` in interface `ContentHandler`
  Overrides:
    `setDocumentLocator` in class `DefaultHandler`

### getCurrentLocation

    public Location getCurrentLocation()

  Calculates the STAX `Location`from the SAX `Locator` registered with this handler. If no `Locator`was provided, then this method will return `null`.

### error

    public void error(SAXParseException e)
               throws SAXException

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

### fatalError

    public void fatalError(SAXParseException e)
                    throws SAXException

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

### warning

    public void warning(SAXParseException e)
                 throws SAXException

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

### startPrefixMapping

    public void startPrefixMapping(String prefix,
                                   String uri)
                            throws SAXException

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

### endPrefixMapping

    public void endPrefixMapping(String prefix)
                          throws SAXException

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

### startCDATA

    public void startCDATA()
                    throws SAXException

  Specified by:
    `startCDATA` in interface `LexicalHandler`
  Throws:
    `SAXException`

### endDTD

    public void endDTD()
                throws SAXException

  Specified by:
    `endDTD` in interface `LexicalHandler`
  Throws:
    `SAXException`

### endEntity

    public void endEntity(String name)
                   throws SAXException

  Specified by:
    `endEntity` in interface `LexicalHandler`
  Throws:
    `SAXException`

### startDTD

    public void startDTD(String name,
                         String publicId,
                         String systemId)
                  throws SAXException

  Specified by:
    `startDTD` in interface `LexicalHandler`
  Throws:
    `SAXException`

### startEntity

    public void startEntity(String name)
                     throws SAXException

  Specified by:
    `startEntity` in interface `LexicalHandler`
  Throws:
    `SAXException`

### reportException

    protected void reportException(String type,
                                   SAXException e)
                            throws SAXException

  Used to report a `SAXException`to the `XMLReporter` registered with this handler.

  Throws:
    `SAXException`

### finish

    public void finish()

  Description copied from interface: `PipelineComponent`
  This method is called after pipeline run - regardless if the run was successful or an exception was thrown.

  Specified by:
    `finish` in interface `PipelineComponent`

### setConfiguration

    public void setConfiguration(Map<String,? extends Object> configuration)

  Description copied from interface: `PipelineComponent`
  Pass component specific configuration parameters to the pipeline component in a generic way. This is useful in environments that automatically assemble pipelines with their components and can't use the components constructors or setters.

  Specified by:
    `setConfiguration` in interface `PipelineComponent`
  Parameters:
    `configuration` - The `Map` of configuration parameters.

### setup

    public void setup(Map<String,Object> parameters)

  Description copied from interface: `PipelineComponent`
  The shared object map for this pipeline run.

  Specified by:
    `setup` in interface `PipelineComponent`
  Parameters:
    `parameters` - A `Map` of parameters that are available to all `PipelineComponent`s. This is a modifiable map that can be changed by this pipeline component.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008-2011 The Apache Software Foundation. All Rights Reserved.