Nux 1.6

nux.xom.sandbox
Class StaxFragmentStreamWriter

java.lang.Object
  extended by nux.xom.sandbox.StaxFilteredStreamWriter
      extended by nux.xom.sandbox.StaxFragmentStreamWriter
All Implemented Interfaces:
XMLStreamWriter

public final class StaxFragmentStreamWriter
extends StaxFilteredStreamWriter

StAX XMLStreamWriter that delegates all calls to the given underlying child writer, except that calls to all close, writeStartDocument and writeEndDocument flavours are silently ignored.

Consider SOAP frameworks (or similar), where the framework writes the SOAP header to an XMLStreamWriter, and the application writes the SOAP body (i.e. a fragment aka element subtree) via a StreamingSerializer to the same XMLStreamWriter. The application needs a way to write a fragment without writing START_DOCUMENT and END_DOCUMENT events, but StreamingSerializer doesn't really allow that, in order to ensure wellformedness.

This class enables StreamingSerializer applications to do just that, without requiring weird and unsafe extensions to the StreamingSerializer interface.

Author:
whoschek.AT.lbl.DOT.gov, $Author: hoschek3 $

Constructor Summary
StaxFragmentStreamWriter(XMLStreamWriter child)
          Constructs an instance that delegates to the given child writer.
 
Method Summary
 void close()
          
 void writeEndDocument()
          
 void writeStartDocument()
          
 void writeStartDocument(String version)
          
 void writeStartDocument(String encoding, String version)
          
 
Methods inherited from class nux.xom.sandbox.StaxFilteredStreamWriter
flush, getNamespaceContext, getPrefix, getProperty, setDefaultNamespace, setNamespaceContext, setPrefix, writeAttribute, writeAttribute, writeAttribute, writeCData, writeCharacters, writeCharacters, writeComment, writeDefaultNamespace, writeDTD, writeEmptyElement, writeEmptyElement, writeEmptyElement, writeEndElement, writeEntityRef, writeNamespace, writeProcessingInstruction, writeProcessingInstruction, writeStartElement, writeStartElement, writeStartElement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StaxFragmentStreamWriter

public StaxFragmentStreamWriter(XMLStreamWriter child)
Constructs an instance that delegates to the given child writer.

Parameters:
child - the writer to delegate to
Method Detail

close

public void close()
           throws XMLStreamException
Description copied from class: StaxFilteredStreamWriter

Specified by:
close in interface XMLStreamWriter
Overrides:
close in class StaxFilteredStreamWriter
Throws:
XMLStreamException

writeEndDocument

public void writeEndDocument()
                      throws XMLStreamException
Description copied from class: StaxFilteredStreamWriter

Specified by:
writeEndDocument in interface XMLStreamWriter
Overrides:
writeEndDocument in class StaxFilteredStreamWriter
Throws:
XMLStreamException

writeStartDocument

public void writeStartDocument()
                        throws XMLStreamException
Description copied from class: StaxFilteredStreamWriter

Specified by:
writeStartDocument in interface XMLStreamWriter
Overrides:
writeStartDocument in class StaxFilteredStreamWriter
Throws:
XMLStreamException

writeStartDocument

public void writeStartDocument(String version)
                        throws XMLStreamException
Description copied from class: StaxFilteredStreamWriter

Specified by:
writeStartDocument in interface XMLStreamWriter
Overrides:
writeStartDocument in class StaxFilteredStreamWriter
Throws:
XMLStreamException

writeStartDocument

public void writeStartDocument(String encoding,
                               String version)
                        throws XMLStreamException
Description copied from class: StaxFilteredStreamWriter

Specified by:
writeStartDocument in interface XMLStreamWriter
Overrides:
writeStartDocument in class StaxFilteredStreamWriter
Throws:
XMLStreamException

Nux 1.6