Interface TypedXMLStreamWriter

All Superinterfaces:
XMLStreamWriter
All Known Subinterfaces:
XMLStreamWriter2
All Known Implementing Classes:
DOMWrappingWriter, Stax2WriterAdapter, Stax2WriterImpl, StreamWriter2Delegate

public interface TypedXMLStreamWriter extends XMLStreamWriter
This interface provides a typed extension to XMLStreamWriter. It defines methods for writing XML data from Java types.

Exceptions to throw are declared to be basic XMLStreamExceptions, because in addition to specific TypedXMLStreamExceptions (which are more specific subclasses) that are thrown if conversion itself fails, methods also need to access underlying textual content which may throw other subtypes of stream exception.

Since:
3.0
  • Method Details

    • writeBoolean

      void writeBoolean(boolean value) throws XMLStreamException
      Write a boolean value to the output as textual element content. The lexical representation of content is defined by the XML Schema boolean data type.
      Parameters:
      value - The boolean value to write.
      Throws:
      XMLStreamException
    • writeInt

      void writeInt(int value) throws XMLStreamException
      Write an int value to the output as textual element content. The lexical representation of content is defined by the XML Schema integer data type.
      Throws:
      XMLStreamException
    • writeLong

      void writeLong(long value) throws XMLStreamException
      Write a long value to the output as textual element content. The lexical representation of content is defined by the XML Schema long data type.
      Throws:
      XMLStreamException
    • writeFloat

      void writeFloat(float value) throws XMLStreamException
      Write a float value to the output as textual element content. The lexical representation of content is defined by the XML Schema float data type.
      Throws:
      XMLStreamException
    • writeDouble

      void writeDouble(double value) throws XMLStreamException
      Write a double value to the output as textual element content. The lexical representation of content is defined by the XML Schema double data type.
      Throws:
      XMLStreamException
    • writeInteger

      void writeInteger(BigInteger value) throws XMLStreamException
      Throws:
      XMLStreamException
    • writeDecimal

      void writeDecimal(BigDecimal value) throws XMLStreamException
      Write a decimal value to the output as textual element content. The lexical representation of content is defined by the XML Schema decimal data type.
      Throws:
      XMLStreamException
    • writeQName

      void writeQName(QName value) throws XMLStreamException
      Throws:
      XMLStreamException
    • writeBinary

      void writeBinary(byte[] value, int from, int length) throws XMLStreamException

      Write binary content as base64 encoded characters to the output. The lexical representation of a byte array is defined by the XML Schema base64Binary data type. This method can be called multiple times to write the array in chunks; but if so, callers should write output in chunks divisible by 3 (natural atomic unit of base64 output, which avoids padding) to maximize interoperability.

      Note: base64 variant defaults to Base64Variants.MIME.

      Parameters:
      value - The array from which to write the bytes.
      from - The index in the array from which writing starts.
      length - The number of bytes to write.
      Throws:
      XMLStreamException
    • writeBinary

      void writeBinary(Base64Variant variant, byte[] value, int from, int length) throws XMLStreamException
      Throws:
      XMLStreamException
    • writeIntArray

      void writeIntArray(int[] value, int from, int length) throws XMLStreamException

      Write int array to the output. The lexical representation of a int array is defined by the following XML schema type:

          <xs:simpleType name="intArray">
             <xs:list itemType="xs:int"/>
          </xs:simpleType>
      whose lexical space is a list of space-separated ints. This method can be called multiple times to write the array in chunks.
      Parameters:
      value - The array from which to write the ints.
      from - The index in the array from which writing starts.
      length - The number of ints to write.
      Throws:
      XMLStreamException
    • writeLongArray

      void writeLongArray(long[] value, int from, int length) throws XMLStreamException
      Throws:
      XMLStreamException
    • writeFloatArray

      void writeFloatArray(float[] value, int from, int length) throws XMLStreamException
      Throws:
      XMLStreamException
    • writeDoubleArray

      void writeDoubleArray(double[] value, int from, int length) throws XMLStreamException
      Throws:
      XMLStreamException
    • writeBooleanAttribute

      void writeBooleanAttribute(String prefix, String namespaceURI, String localName, boolean value) throws XMLStreamException
      Write a boolean value to the output as attribute value. The lexical representation of content is defined by the XML Schema boolean data type.
      Parameters:
      prefix - The attribute's prefix. Null or "" if no prefix is to be used
      namespaceURI - The attribute's URI (can be either null or empty String for "no namespace")
      localName - The attribute's local name
      value - The boolean value to write.
      Throws:
      XMLStreamException
    • writeIntAttribute

      void writeIntAttribute(String prefix, String namespaceURI, String localName, int value) throws XMLStreamException
      Write an integer value to the output as attribute value. The lexical representation of content is defined by the XML Schema integer data type.
      Parameters:
      prefix - The attribute's prefix. Null or "" if no prefix is to be used
      namespaceURI - The attribute's URI (can be either null or empty String for "no namespace")
      localName - The attribute's local name
      value - The integer value to write.
      Throws:
      XMLStreamException
    • writeLongAttribute

      void writeLongAttribute(String prefix, String namespaceURI, String localName, long value) throws XMLStreamException
      Write an long value to the output as attribute value. The lexical representation of content is defined by the XML Schema long data type.
      Parameters:
      prefix - The attribute's prefix. Null or "" if no prefix is to be used
      namespaceURI - The attribute's URI (can be either null or empty String for "no namespace")
      localName - The attribute's local name
      value - The long value to write.
      Throws:
      XMLStreamException
    • writeFloatAttribute

      void writeFloatAttribute(String prefix, String namespaceURI, String localName, float value) throws XMLStreamException
      Throws:
      XMLStreamException
    • writeDoubleAttribute

      void writeDoubleAttribute(String prefix, String namespaceURI, String localName, double value) throws XMLStreamException
      Throws:
      XMLStreamException
    • writeIntegerAttribute

      void writeIntegerAttribute(String prefix, String namespaceURI, String localName, BigInteger value) throws XMLStreamException
      Throws:
      XMLStreamException
    • writeDecimalAttribute

      void writeDecimalAttribute(String prefix, String namespaceURI, String localName, BigDecimal value) throws XMLStreamException
      Throws:
      XMLStreamException
    • writeQNameAttribute

      void writeQNameAttribute(String prefix, String namespaceURI, String localName, QName value) throws XMLStreamException
      Throws:
      XMLStreamException
    • writeBinaryAttribute

      void writeBinaryAttribute(String prefix, String namespaceURI, String localName, byte[] value) throws XMLStreamException

      Write a byte array attribute. The lexical representation of a byte array is defined by the XML Schema base64Binary data type.

      Note: base64 variant defaults to Base64Variants.MIME.

      Parameters:
      prefix - The attribute's prefix.
      namespaceURI - The attribute's URI.
      localName - The attribute's local name.
      value - The array from which to write the bytes.
      Throws:
      XMLStreamException
    • writeBinaryAttribute

      void writeBinaryAttribute(Base64Variant variant, String prefix, String namespaceURI, String localName, byte[] value) throws XMLStreamException
      Throws:
      XMLStreamException
    • writeIntArrayAttribute

      void writeIntArrayAttribute(String prefix, String namespaceURI, String localName, int[] value) throws XMLStreamException

      Write int array attribute. The lexical representation of a int array is defined by the following XML schema type:

          <xs:simpleType name="intArray">
             <xs:list itemType="xs:int"/>
          </xs:simpleType>
      whose lexical space is a list of space-separated ints.
      Parameters:
      prefix - The attribute's prefix.
      namespaceURI - The attribute's URI.
      localName - The attribute's local name.
      value - The array from which to write the ints.
      Throws:
      XMLStreamException
    • writeLongArrayAttribute

      void writeLongArrayAttribute(String prefix, String namespaceURI, String localName, long[] value) throws XMLStreamException
      Throws:
      XMLStreamException
    • writeFloatArrayAttribute

      void writeFloatArrayAttribute(String prefix, String namespaceURI, String localName, float[] value) throws XMLStreamException
      Throws:
      XMLStreamException
    • writeDoubleArrayAttribute

      void writeDoubleArrayAttribute(String prefix, String namespaceURI, String localName, double[] value) throws XMLStreamException
      Throws:
      XMLStreamException