Top Description Methods
org.codehaus.stax2.typed

public Interface TypedXMLStreamWriter

extends XMLStreamWriter
Known Direct Subinterfaces
org.codehaus.stax2.XMLStreamWriter2
Imports
java.math.BigDecimal, .BigInteger, javax.xml.namespace.QName, javax.xml.stream.XMLStreamException, .XMLStreamWriter

This interface provides a typed extension to javax.xml.stream.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.

Authors
[email protected], Tatu Saloranta
Since
3.0

Method Summary

Modifier and TypeMethod and Description
public void
writeBinary(byte[]
The array from which to write the bytes.
value
,
int
The index in the array from which writing starts.
from
,
int
The number of bytes to write.
length
)

Write binary content as base64 encoded characters to the output.

public void
writeBinary(Base64Variant variant, byte[] value, int from, int length)

public void
writeBinaryAttribute(String
The attribute's prefix.
prefix
,
String
The attribute's URI.
namespaceURI
,
String
The attribute's local name.
localName
,
byte[]
The array from which to write the bytes.
value
)

Write a byte array attribute.

public void
writeBinaryAttribute(Base64Variant variant, String prefix, String namespaceURI, String localName, byte[] value)

public void
writeBoolean(boolean
The boolean value to write.
value
)

Write a boolean value to the output as textual element content.

public void
writeBooleanAttribute(String
The attribute's prefix. Null or "" if no prefix is to be used
prefix
,
String
The attribute's URI (can be either null or empty String for "no namespace")
namespaceURI
,
String
The attribute's local name
localName
,
boolean
The boolean value to write.
value
)

Write a boolean value to the output as attribute value.

public void
writeDecimal(BigDecimal value)

Write a decimal value to the output as textual element content.

public void
writeDecimalAttribute(String prefix, String namespaceURI, String localName, BigDecimal value)

public void
writeDouble(double value)

Write a double value to the output as textual element content.

public void
writeDoubleArray(double[] value, int from, int length)

public void
writeDoubleArrayAttribute(String prefix, String namespaceURI, String localName, double[] value)

public void
writeDoubleAttribute(String prefix, String namespaceURI, String localName, double value)

public void
writeFloat(float value)

Write a float value to the output as textual element content.

public void
writeFloatArray(float[] value, int from, int length)

public void
writeFloatArrayAttribute(String prefix, String namespaceURI, String localName, float[] value)

public void
writeFloatAttribute(String prefix, String namespaceURI, String localName, float value)

public void
writeInt(int value)

Write an int value to the output as textual element content.

public void
writeIntArray(int[]
The array from which to write the ints.
value
,
int
The index in the array from which writing starts.
from
,
int
The number of ints to write.
length
)

Write int array to the output.

public void
writeIntArrayAttribute(String
The attribute's prefix.
prefix
,
String
The attribute's URI.
namespaceURI
,
String
The attribute's local name.
localName
,
int[]
The array from which to write the ints.
value
)

Write int array attribute.

public void
writeIntAttribute(String
The attribute's prefix. Null or "" if no prefix is to be used
prefix
,
String
The attribute's URI (can be either null or empty String for "no namespace")
namespaceURI
,
String
The attribute's local name
localName
,
int
The integer value to write.
value
)

Write an integer value to the output as attribute value.

public void
public void
writeIntegerAttribute(String prefix, String namespaceURI, String localName, BigInteger value)

public void
writeLong(long value)

Write a long value to the output as textual element content.

public void
writeLongArray(long[] value, int from, int length)

public void
writeLongArrayAttribute(String prefix, String namespaceURI, String localName, long[] value)

public void
writeLongAttribute(String
The attribute's prefix. Null or "" if no prefix is to be used
prefix
,
String
The attribute's URI (can be either null or empty String for "no namespace")
namespaceURI
,
String
The attribute's local name
localName
,
long
The long value to write.
value
)

Write an long value to the output as attribute value.

public void
public void
writeQNameAttribute(String prefix, String namespaceURI, String localName, QName value)

Inherited from javax.xml.stream.XMLStreamWriter:
closeflushgetNamespaceContextgetPrefixgetPropertysetDefaultNamespacesetNamespaceContextsetPrefixwriteAttributewriteAttributewriteAttributewriteCDatawriteCharacterswriteCharacterswriteCommentwriteDefaultNamespacewriteDTDwriteEmptyElementwriteEmptyElementwriteEmptyElementwriteEndDocumentwriteEndElementwriteEntityRefwriteNamespacewriteProcessingInstructionwriteProcessingInstructionwriteStartDocumentwriteStartDocumentwriteStartDocumentwriteStartElementwriteStartElementwriteStartElement

Method Detail

writeBinaryback to summary
public 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:byte[]

The array from which to write the bytes.

from:int

The index in the array from which writing starts.

length:int

The number of bytes to write.

writeBinaryback to summary
public void writeBinary(Base64Variant variant, byte[] value, int from, int length) throws XMLStreamException
writeBinaryAttributeback to summary
public 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:String

The attribute's prefix.

namespaceURI:String

The attribute's URI.

localName:String

The attribute's local name.

value:byte[]

The array from which to write the bytes.

writeBinaryAttributeback to summary
public void writeBinaryAttribute(Base64Variant variant, String prefix, String namespaceURI, String localName, byte[] value) throws XMLStreamException
writeBooleanback to summary
public 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:boolean

The boolean value to write.

writeBooleanAttributeback to summary
public 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:String

The attribute's prefix. Null or "" if no prefix is to be used

namespaceURI:String

The attribute's URI (can be either null or empty String for "no namespace")

localName:String

The attribute's local name

value:boolean

The boolean value to write.

writeDecimalback to summary
public 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.

writeDecimalAttributeback to summary
public void writeDecimalAttribute(String prefix, String namespaceURI, String localName, BigDecimal value) throws XMLStreamException
writeDoubleback to summary
public 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.

writeDoubleArrayback to summary
public void writeDoubleArray(double[] value, int from, int length) throws XMLStreamException
writeDoubleArrayAttributeback to summary
public void writeDoubleArrayAttribute(String prefix, String namespaceURI, String localName, double[] value) throws XMLStreamException
writeDoubleAttributeback to summary
public void writeDoubleAttribute(String prefix, String namespaceURI, String localName, double value) throws XMLStreamException
writeFloatback to summary
public 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.

writeFloatArrayback to summary
public void writeFloatArray(float[] value, int from, int length) throws XMLStreamException
writeFloatArrayAttributeback to summary
public void writeFloatArrayAttribute(String prefix, String namespaceURI, String localName, float[] value) throws XMLStreamException
writeFloatAttributeback to summary
public void writeFloatAttribute(String prefix, String namespaceURI, String localName, float value) throws XMLStreamException
writeIntback to summary
public 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.

writeIntArrayback to summary
public 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:int[]

The array from which to write the ints.

from:int

The index in the array from which writing starts.

length:int

The number of ints to write.

writeIntArrayAttributeback to summary
public 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:String

The attribute's prefix.

namespaceURI:String

The attribute's URI.

localName:String

The attribute's local name.

value:int[]

The array from which to write the ints.

writeIntAttributeback to summary
public 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:String

The attribute's prefix. Null or "" if no prefix is to be used

namespaceURI:String

The attribute's URI (can be either null or empty String for "no namespace")

localName:String

The attribute's local name

value:int

The integer value to write.

writeIntegerback to summary
public void writeInteger(BigInteger value) throws XMLStreamException
writeIntegerAttributeback to summary
public void writeIntegerAttribute(String prefix, String namespaceURI, String localName, BigInteger value) throws XMLStreamException
writeLongback to summary
public 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.

writeLongArrayback to summary
public void writeLongArray(long[] value, int from, int length) throws XMLStreamException
writeLongArrayAttributeback to summary
public void writeLongArrayAttribute(String prefix, String namespaceURI, String localName, long[] value) throws XMLStreamException
writeLongAttributeback to summary
public 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:String

The attribute's prefix. Null or "" if no prefix is to be used

namespaceURI:String

The attribute's URI (can be either null or empty String for "no namespace")

localName:String

The attribute's local name

value:long

The long value to write.

writeQNameback to summary
public void writeQName(QName value) throws XMLStreamException
writeQNameAttributeback to summary
public void writeQNameAttribute(String prefix, String namespaceURI, String localName, QName value) throws XMLStreamException