Class StaxWriterImpl<N>

java.lang.Object
org.gatein.common.xml.stax.writer.StaxWriterImpl<N>
All Implemented Interfaces:
XMLStreamConstants, StaxWriter<N>

public class StaxWriterImpl<N> extends Object implements StaxWriter<N>, XMLStreamConstants
Version:
$Revision$
Author:
Nick Scavelli
  • Constructor Details

  • Method Details

    • writeAttribute

      public StaxWriter<N> writeAttribute(String name, String value)
      Description copied from interface: StaxWriter
      Writes an attribute for an xml element. Requires that an element has been started first.
      Specified by:
      writeAttribute in interface StaxWriter<N>
      Parameters:
      name - the name of the attribute
      value - the value of the attribute
      Returns:
      StaxWriter
    • writeAttribute

      public StaxWriter<N> writeAttribute(QName name, String value)
      Description copied from interface: StaxWriter
      Writes an attribute for an xml element. Requires that an element has been started first.
      Specified by:
      writeAttribute in interface StaxWriter<N>
      Parameters:
      name - QName object representing the name of the attribute
      value - the value of the attribute
      Returns:
      StaxWriter
    • writeStartElement

      public StaxWriter<N> writeStartElement(N element) throws org.staxnav.StaxNavException
      Description copied from interface: StaxWriter
      Writes the start tag of an xml element. Requires that an element has been started first.
      Specified by:
      writeStartElement in interface StaxWriter<N>
      Parameters:
      element - element to start
      Returns:
      StaxWriter
      Throws:
      org.staxnav.StaxNavException - if an exception occurs
    • writeEndElement

      public StaxWriter<N> writeEndElement() throws org.staxnav.StaxNavException
      Description copied from interface: StaxWriter
      Writes an end tag for the previously started element. Requires that an element has been started first.
      Specified by:
      writeEndElement in interface StaxWriter<N>
      Returns:
      StaxWriter
      Throws:
      org.staxnav.StaxNavException - if an exception occurs
    • writeContent

      public StaxWriter<N> writeContent(String content) throws org.staxnav.StaxNavException
      Description copied from interface: StaxWriter
      Writes xml content. Requires an xml element has been started first.
      Specified by:
      writeContent in interface StaxWriter<N>
      Parameters:
      content - content to be written
      Returns:
      StaxWriter
      Throws:
      org.staxnav.StaxNavException - if an exception occurs
    • writeContent

      public <V> StaxWriter<N> writeContent(WritableValueType<V> valueType, V content) throws org.staxnav.StaxNavException
      Description copied from interface: StaxWriter
      Writes xml content based on the ValueType responsible for converting the content to string. Requires an xml element has been started first.
      Specified by:
      writeContent in interface StaxWriter<N>
      Parameters:
      valueType - object responsible for writing content to string
      content - content to be written
      Returns:
      StaxWriter
      Throws:
      org.staxnav.StaxNavException - if an exception occurs
    • writeElement

      public <V> StaxWriter<N> writeElement(N element, String content) throws org.staxnav.StaxNavException
      Description copied from interface: StaxWriter
      Convenience method for calling writeStartElement, writeContent, writeEndElement
      Specified by:
      writeElement in interface StaxWriter<N>
      Parameters:
      element - element to write
      content - content to be written
      Returns:
      StaxWriter
      Throws:
      org.staxnav.StaxNavException - if an exception occurs
    • writeElement

      public <V> StaxWriter<N> writeElement(N element, WritableValueType<V> valueType, V content) throws org.staxnav.StaxNavException
      Description copied from interface: StaxWriter
      Convenience method for calling writeStartElement, writeContent, writeEndElement
      Specified by:
      writeElement in interface StaxWriter<N>
      Parameters:
      element - element to write
      valueType - object responsible for writing content to string
      content - content to be written
      Returns:
      StaxWriter
      Throws:
      org.staxnav.StaxNavException - if an exception occurs
    • writeNamespace

      public StaxWriter<N> writeNamespace(String prefix, String uri) throws org.staxnav.StaxNavException
      Description copied from interface: StaxWriter
      Writes the namespace. If prefix is an empty string, "xmlns", or null this will delegate to writeDefaultNamespace
      Specified by:
      writeNamespace in interface StaxWriter<N>
      Parameters:
      prefix - the prefix to bind the namespace to
      uri - the uri to bind the prefix to
      Returns:
      StaxWriter
      Throws:
      org.staxnav.StaxNavException - if an exception occurs
    • writeDefaultNamespace

      public StaxWriter<N> writeDefaultNamespace(String uri) throws org.staxnav.StaxNavException
      Description copied from interface: StaxWriter
      Writes the default namespace
      Specified by:
      writeDefaultNamespace in interface StaxWriter<N>
      Parameters:
      uri - the uri to bind the default namespace to
      Returns:
      StaxWriter
      Throws:
      org.staxnav.StaxNavException - if an exception occurs
    • writeComment

      public StaxWriter<N> writeComment(String comment) throws org.staxnav.StaxNavException
      Description copied from interface: StaxWriter
      Writes an xml comment
      Specified by:
      writeComment in interface StaxWriter<N>
      Parameters:
      comment - the comment to write
      Returns:
      StaxWriter
      Throws:
      org.staxnav.StaxNavException - if an exception occurs
    • writeCData

      public StaxWriter<N> writeCData(String cdata) throws org.staxnav.StaxNavException
      Description copied from interface: StaxWriter
      Writes a cdata section
      Specified by:
      writeCData in interface StaxWriter<N>
      Parameters:
      cdata - content of the cdata
      Returns:
      StaxWriter
      Throws:
      org.staxnav.StaxNavException - if an exception occurs
    • finish

      public void finish() throws org.staxnav.StaxNavException
      Description copied from interface: StaxWriter
      Calling finish will flush and close the underlying stream. It will also call any endElements for you if they were never explicitly called.
      Specified by:
      finish in interface StaxWriter<N>
      Throws:
      org.staxnav.StaxNavException - if an exception occurs