org.apache.cocoon.stax.component
Class XMLGenerator

java.lang.Object
  extended by org.apache.cocoon.pipeline.component.AbstractPipelineComponent
      extended by org.apache.cocoon.stax.AbstractStAXPipelineComponent
          extended by org.apache.cocoon.stax.AbstractStAXProducer
              extended by org.apache.cocoon.stax.component.XMLGenerator
All Implemented Interfaces:
PipelineComponent, Producer, Starter, StAXPipelineComponent, StAXProducer

public class XMLGenerator
extends AbstractStAXProducer
implements Starter

General element generator for a StAX pipeline directly taking all elements from an internal XMLEventReader created from an InputStream or directly from an URL.


Constructor Summary
XMLGenerator()
           
XMLGenerator(InputStream inputStream)
          Creating an XMLGenerator with an XMLEventReader from an InputStream.
 
Method Summary
protected  InputStream copyInputstream(URLConnection connection)
           
 void execute()
          
 boolean hasNext()
          Check if there are more events.
 XMLEvent nextEvent()
          Get the next XMLEvent
 XMLEvent peek()
          Check the next XMLEvent without reading it from the stream.
 void setConfiguration(Map<String,? extends Object> configuration)
          Pass component specific configuration parameters to the pipeline component in a generic way.
 
Methods inherited from class org.apache.cocoon.stax.AbstractStAXProducer
getConsumer, setConsumer
 
Methods inherited from class org.apache.cocoon.pipeline.component.AbstractPipelineComponent
finish, setup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.cocoon.pipeline.component.PipelineComponent
finish, setup
 

Constructor Detail

XMLGenerator

public XMLGenerator()

XMLGenerator

public XMLGenerator(InputStream inputStream)
Creating an XMLGenerator with an XMLEventReader from an InputStream.

Parameters:
inputStream - from which a XMLEventReader is produced read from during the execute() method call.
Throws:
SetupException - if any error occurred during the creation of the XMLEventReader.
Method Detail

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
Overrides:
setConfiguration in class AbstractPipelineComponent
Parameters:
configuration - The Map of configuration parameters.

copyInputstream

protected InputStream copyInputstream(URLConnection connection)
                               throws IOException
Throws:
IOException

execute

public void execute()

Specified by:
execute in interface Starter
See Also:
Starter.execute()

hasNext

public boolean hasNext()
Check if there are more events. Returns true if there are more events and false otherwise.

Specified by:
hasNext in interface StAXProducer
Returns:
true if the event reader has more events, false otherwise
See Also:
StAXProducer.hasNext()

nextEvent

public XMLEvent nextEvent()
                   throws XMLStreamException
Get the next XMLEvent

Specified by:
nextEvent in interface StAXProducer
Throws:
XMLStreamException
See Also:
StAXProducer.nextEvent()

peek

public XMLEvent peek()
              throws XMLStreamException
Check the next XMLEvent without reading it from the stream. Returns null if the stream is at EOF or has no more XMLEvents. A call to peek() will be equal to the next return of next().

Specified by:
peek in interface StAXProducer
Throws:
XMLStreamException
See Also:
StAXProducer.peek()


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