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(InputStream inputStream)
          Creating an XMLGenerator with an XMLEventReader from an InputStream.
 
Method Summary
 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.
 
Methods inherited from class org.apache.cocoon.stax.AbstractStAXProducer
getConsumer, setConsumer
 
Methods inherited from class org.apache.cocoon.pipeline.component.AbstractPipelineComponent
finish, setConfiguration, 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, setConfiguration, setup
 

Constructor Detail

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

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-2011 The Apache Software Foundation. All Rights Reserved.