org.apache.axis2.datasource.jaxb
Class XMLStreamWriterArrayFilter

java.lang.Object
  extended by org.apache.axis2.datasource.jaxb.XMLStreamWriterArrayFilter
All Implemented Interfaces:
XMLStreamWriter

public class XMLStreamWriterArrayFilter
extends Object
implements XMLStreamWriter

In some cases, we want to marshal an array of objects as a series of elements instead of a single element containing items. Unfortunately there is no way to tell the JAXB marshal method to marshal an array or List as a series of elements. Instead, we use the JAXB marshal method to output a single element with items and then filter the write events to transform it into a series of elements. Thus Hello World Becomes Hello World Special care is taken to ensure that namespace declarations are property preserved.


Constructor Summary
XMLStreamWriterArrayFilter(XMLStreamWriter writer)
           
 
Method Summary
 void close()
           
 void flush()
           
 NamespaceContext getNamespaceContext()
           
 String getPrefix(String arg0)
           
 Object getProperty(String arg0)
           
 void setDefaultNamespace(String arg0)
           
 void setNamespaceContext(NamespaceContext arg0)
           
 void setPrefix(String arg0, String arg1)
           
 void writeAttribute(String arg0, String arg1)
           
 void writeAttribute(String arg0, String arg1, String arg2)
           
 void writeAttribute(String prefix, String uri, String localName, String value)
           
 void writeCData(String arg0)
           
 void writeCharacters(char[] arg0, int arg1, int arg2)
           
 void writeCharacters(String arg0)
           
 void writeComment(String arg0)
           
 void writeDefaultNamespace(String uri)
           
 void writeDTD(String arg0)
           
 void writeEmptyElement(String arg0)
           
 void writeEmptyElement(String arg0, String arg1)
           
 void writeEmptyElement(String arg0, String arg1, String arg2)
           
 void writeEndDocument()
           
 void writeEndElement()
           
 void writeEntityRef(String arg0)
           
 void writeNamespace(String prefix, String uri)
           
 void writeProcessingInstruction(String arg0)
           
 void writeProcessingInstruction(String arg0, String arg1)
           
 void writeStartDocument()
           
 void writeStartDocument(String arg0)
           
 void writeStartDocument(String arg0, String arg1)
           
 void writeStartElement(String arg0)
           
 void writeStartElement(String arg0, String arg1)
           
 void writeStartElement(String arg0, String arg1, String arg2)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLStreamWriterArrayFilter

public XMLStreamWriterArrayFilter(XMLStreamWriter writer)
                           throws XMLStreamException
Throws:
XMLStreamException
Method Detail

close

public void close()
           throws XMLStreamException
Specified by:
close in interface XMLStreamWriter
Throws:
XMLStreamException

flush

public void flush()
           throws XMLStreamException
Specified by:
flush in interface XMLStreamWriter
Throws:
XMLStreamException

getNamespaceContext

public NamespaceContext getNamespaceContext()
Specified by:
getNamespaceContext in interface XMLStreamWriter

getPrefix

public String getPrefix(String arg0)
                 throws XMLStreamException
Specified by:
getPrefix in interface XMLStreamWriter
Throws:
XMLStreamException

getProperty

public Object getProperty(String arg0)
                   throws IllegalArgumentException
Specified by:
getProperty in interface XMLStreamWriter
Throws:
IllegalArgumentException

setDefaultNamespace

public void setDefaultNamespace(String arg0)
                         throws XMLStreamException
Specified by:
setDefaultNamespace in interface XMLStreamWriter
Throws:
XMLStreamException

setNamespaceContext

public void setNamespaceContext(NamespaceContext arg0)
                         throws XMLStreamException
Specified by:
setNamespaceContext in interface XMLStreamWriter
Throws:
XMLStreamException

setPrefix

public void setPrefix(String arg0,
                      String arg1)
               throws XMLStreamException
Specified by:
setPrefix in interface XMLStreamWriter
Throws:
XMLStreamException

writeAttribute

public void writeAttribute(String prefix,
                           String uri,
                           String localName,
                           String value)
                    throws XMLStreamException
Specified by:
writeAttribute in interface XMLStreamWriter
Throws:
XMLStreamException

writeAttribute

public void writeAttribute(String arg0,
                           String arg1,
                           String arg2)
                    throws XMLStreamException
Specified by:
writeAttribute in interface XMLStreamWriter
Throws:
XMLStreamException

writeAttribute

public void writeAttribute(String arg0,
                           String arg1)
                    throws XMLStreamException
Specified by:
writeAttribute in interface XMLStreamWriter
Throws:
XMLStreamException

writeCData

public void writeCData(String arg0)
                throws XMLStreamException
Specified by:
writeCData in interface XMLStreamWriter
Throws:
XMLStreamException

writeCharacters

public void writeCharacters(char[] arg0,
                            int arg1,
                            int arg2)
                     throws XMLStreamException
Specified by:
writeCharacters in interface XMLStreamWriter
Throws:
XMLStreamException

writeCharacters

public void writeCharacters(String arg0)
                     throws XMLStreamException
Specified by:
writeCharacters in interface XMLStreamWriter
Throws:
XMLStreamException

writeComment

public void writeComment(String arg0)
                  throws XMLStreamException
Specified by:
writeComment in interface XMLStreamWriter
Throws:
XMLStreamException

writeDefaultNamespace

public void writeDefaultNamespace(String uri)
                           throws XMLStreamException
Specified by:
writeDefaultNamespace in interface XMLStreamWriter
Throws:
XMLStreamException

writeDTD

public void writeDTD(String arg0)
              throws XMLStreamException
Specified by:
writeDTD in interface XMLStreamWriter
Throws:
XMLStreamException

writeEmptyElement

public void writeEmptyElement(String arg0,
                              String arg1,
                              String arg2)
                       throws XMLStreamException
Specified by:
writeEmptyElement in interface XMLStreamWriter
Throws:
XMLStreamException

writeEmptyElement

public void writeEmptyElement(String arg0,
                              String arg1)
                       throws XMLStreamException
Specified by:
writeEmptyElement in interface XMLStreamWriter
Throws:
XMLStreamException

writeEmptyElement

public void writeEmptyElement(String arg0)
                       throws XMLStreamException
Specified by:
writeEmptyElement in interface XMLStreamWriter
Throws:
XMLStreamException

writeEndDocument

public void writeEndDocument()
                      throws XMLStreamException
Specified by:
writeEndDocument in interface XMLStreamWriter
Throws:
XMLStreamException

writeEndElement

public void writeEndElement()
                     throws XMLStreamException
Specified by:
writeEndElement in interface XMLStreamWriter
Throws:
XMLStreamException

writeEntityRef

public void writeEntityRef(String arg0)
                    throws XMLStreamException
Specified by:
writeEntityRef in interface XMLStreamWriter
Throws:
XMLStreamException

writeNamespace

public void writeNamespace(String prefix,
                           String uri)
                    throws XMLStreamException
Specified by:
writeNamespace in interface XMLStreamWriter
Throws:
XMLStreamException

writeProcessingInstruction

public void writeProcessingInstruction(String arg0,
                                       String arg1)
                                throws XMLStreamException
Specified by:
writeProcessingInstruction in interface XMLStreamWriter
Throws:
XMLStreamException

writeProcessingInstruction

public void writeProcessingInstruction(String arg0)
                                throws XMLStreamException
Specified by:
writeProcessingInstruction in interface XMLStreamWriter
Throws:
XMLStreamException

writeStartDocument

public void writeStartDocument()
                        throws XMLStreamException
Specified by:
writeStartDocument in interface XMLStreamWriter
Throws:
XMLStreamException

writeStartDocument

public void writeStartDocument(String arg0,
                               String arg1)
                        throws XMLStreamException
Specified by:
writeStartDocument in interface XMLStreamWriter
Throws:
XMLStreamException

writeStartDocument

public void writeStartDocument(String arg0)
                        throws XMLStreamException
Specified by:
writeStartDocument in interface XMLStreamWriter
Throws:
XMLStreamException

writeStartElement

public void writeStartElement(String arg0,
                              String arg1,
                              String arg2)
                       throws XMLStreamException
Specified by:
writeStartElement in interface XMLStreamWriter
Throws:
XMLStreamException

writeStartElement

public void writeStartElement(String arg0,
                              String arg1)
                       throws XMLStreamException
Specified by:
writeStartElement in interface XMLStreamWriter
Throws:
XMLStreamException

writeStartElement

public void writeStartElement(String arg0)
                       throws XMLStreamException
Specified by:
writeStartElement in interface XMLStreamWriter
Throws:
XMLStreamException


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