public abstract class DOMWrappingWriter extends java.lang.Object implements XMLStreamWriter2
XMLStreamWriter
as a facade on top of a DOM document or Node, allowing one
to basically construct DOM trees via Stax API.
It is meant to serve as basis for a full implementation.
Note that the implementation is only to be used with
javax.xml.transform.dom.DOMResult
. It can however be
used for both full documents, and single element root fragments,
depending on what node is passed as the argument.
One more implementation note: much code is identical to one
used by Stax2WriterAdapter
.
Alas it is hard to reuse it without cut'n pasting.
Modifier and Type | Field and Description |
---|---|
(package private) static java.lang.String |
DEFAULT_OUTPUT_ENCODING |
(package private) static java.lang.String |
DEFAULT_XML_VERSION |
protected org.w3c.dom.Document |
mDocument
We need a reference to the document hosting nodes to
be able to create new nodes
|
protected java.lang.String |
mEncoding
This member variable is to keep information about encoding
that seems to be used for the document (or fragment) to output,
if known.
|
protected boolean |
mNsAware |
protected javax.xml.namespace.NamespaceContext |
mNsContext
If we are being given info about existing bindings, it'll come
as a NamespaceContext.
|
protected boolean |
mNsRepairing |
protected SimpleValueEncoder |
mValueEncoder
Encoding of typed values is used the standard encoder
included in RI.
|
Modifier | Constructor and Description |
---|---|
protected |
DOMWrappingWriter(org.w3c.dom.Node treeRoot,
boolean nsAware,
boolean nsRepairing) |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
appendLeaf(org.w3c.dom.Node n) |
void |
close() |
void |
closeCompletely()
Method similar to
XMLStreamWriter.close() ,
except that this method also does close the underlying output
destination (stream) if it has not yet been closed. |
void |
copyEventFromReader(XMLStreamReader2 r,
boolean preserveEventData)
Method that essentially copies
event that the specified reader has just read.
|
void |
flush() |
java.lang.String |
getEncoding()
Method that can be called to get information about encoding that
this writer is using (or at least claims is using).
|
XMLStreamLocation2 |
getLocation()
Method that should return current output location, if the writer
keeps track of it; null if it does not.
|
abstract javax.xml.namespace.NamespaceContext |
getNamespaceContext() |
abstract java.lang.String |
getPrefix(java.lang.String uri) |
abstract java.lang.Object |
getProperty(java.lang.String name) |
protected SimpleValueEncoder |
getValueEncoder() |
abstract boolean |
isPropertySupported(java.lang.String name)
Method similar to
XMLOutputFactory.isPropertySupported(java.lang.String) , used
to determine whether a property is supported by the Writer
instance. |
protected void |
reportUnsupported(java.lang.String operName) |
protected java.lang.String |
serializeQNameValue(javax.xml.namespace.QName name)
Method called to serialize given qualified name into valid
String serialization, taking into account existing namespace
bindings.
|
abstract void |
setDefaultNamespace(java.lang.String uri) |
void |
setNamespaceContext(javax.xml.namespace.NamespaceContext context) |
abstract void |
setPrefix(java.lang.String prefix,
java.lang.String uri) |
abstract boolean |
setProperty(java.lang.String name,
java.lang.Object value)
Method that can be used to set per-writer properties; a subset of
properties one can set via matching
XMLOutputFactory2
instance. |
ValidationProblemHandler |
setValidationProblemHandler(ValidationProblemHandler h)
Method that application can call to define a custom handler for
validation problems encountered during validation process.
|
XMLValidator |
stopValidatingAgainst(XMLValidationSchema schema)
Method that can be called by application to stop validating
output against a schema, for which
Validatable.validateAgainst(org.codehaus.stax2.validation.XMLValidationSchema)
was called earlier. |
XMLValidator |
stopValidatingAgainst(XMLValidator validator)
Method that can be called by application to stop validating
output using specified validator.
|
protected static void |
throwOutputError(java.lang.String msg) |
protected static void |
throwOutputError(java.lang.String format,
java.lang.Object arg) |
XMLValidator |
validateAgainst(XMLValidationSchema schema)
Method that will construct a
XMLValidator instance from the
given schema (unless a validator for that schema has already been
added),
initialize it if necessary, and make validatable object (reader,
writer)
call appropriate validation methods from this point on until the
end of the document (that is, it's not scoped with sub-trees), or until
validator is removed by an explicit call to
Validatable.stopValidatingAgainst(org.codehaus.stax2.validation.XMLValidationSchema) . |
abstract void |
writeAttribute(java.lang.String localName,
java.lang.String value) |
abstract void |
writeAttribute(java.lang.String nsURI,
java.lang.String localName,
java.lang.String value) |
abstract void |
writeAttribute(java.lang.String prefix,
java.lang.String nsURI,
java.lang.String localName,
java.lang.String value) |
void |
writeBinary(Base64Variant v,
byte[] value,
int from,
int length) |
void |
writeBinary(byte[] value,
int from,
int length)
Write binary content as base64 encoded characters to the output.
|
void |
writeBinaryAttribute(Base64Variant v,
java.lang.String prefix,
java.lang.String nsURI,
java.lang.String localName,
byte[] value) |
void |
writeBinaryAttribute(java.lang.String prefix,
java.lang.String nsURI,
java.lang.String localName,
byte[] value)
Write a byte array attribute.
|
void |
writeBoolean(boolean value)
Write a boolean value to the output as textual element content.
|
void |
writeBooleanAttribute(java.lang.String prefix,
java.lang.String nsURI,
java.lang.String localName,
boolean value)
Write a boolean value to the output as attribute value.
|
void |
writeCData(char[] text,
int start,
int len) |
void |
writeCData(java.lang.String data) |
void |
writeCharacters(char[] text,
int start,
int len) |
void |
writeCharacters(java.lang.String text) |
void |
writeComment(java.lang.String data) |
void |
writeDecimal(java.math.BigDecimal value)
Write a decimal value to the output as textual element content.
|
void |
writeDecimalAttribute(java.lang.String prefix,
java.lang.String nsURI,
java.lang.String localName,
java.math.BigDecimal value) |
abstract void |
writeDefaultNamespace(java.lang.String nsURI) |
void |
writeDouble(double value)
Write a double value to the output as textual element content.
|
void |
writeDoubleArray(double[] value,
int from,
int length) |
void |
writeDoubleArrayAttribute(java.lang.String prefix,
java.lang.String nsURI,
java.lang.String localName,
double[] value) |
void |
writeDoubleAttribute(java.lang.String prefix,
java.lang.String nsURI,
java.lang.String localName,
double value) |
void |
writeDTD(java.lang.String dtd) |
abstract void |
writeDTD(java.lang.String rootName,
java.lang.String systemId,
java.lang.String publicId,
java.lang.String internalSubset) |
abstract void |
writeEmptyElement(java.lang.String localName) |
abstract void |
writeEmptyElement(java.lang.String nsURI,
java.lang.String localName) |
abstract void |
writeEmptyElement(java.lang.String prefix,
java.lang.String localName,
java.lang.String nsURI) |
abstract void |
writeEndDocument() |
void |
writeEntityRef(java.lang.String name) |
void |
writeFloat(float value)
Write a float value to the output as textual element content.
|
void |
writeFloatArray(float[] value,
int from,
int length) |
void |
writeFloatArrayAttribute(java.lang.String prefix,
java.lang.String nsURI,
java.lang.String localName,
float[] value) |
void |
writeFloatAttribute(java.lang.String prefix,
java.lang.String nsURI,
java.lang.String localName,
float value) |
void |
writeFullEndElement()
Method similar to
XMLStreamWriter.writeEndElement() , but that will always
write the full end element, instead of empty element. |
void |
writeInt(int value)
Write an int value to the output as textual element content.
|
void |
writeIntArray(int[] value,
int from,
int length)
Write int array to the output.
|
void |
writeIntArrayAttribute(java.lang.String prefix,
java.lang.String nsURI,
java.lang.String localName,
int[] value)
Write int array attribute.
|
void |
writeIntAttribute(java.lang.String prefix,
java.lang.String nsURI,
java.lang.String localName,
int value)
Write an integer value to the output as attribute value.
|
void |
writeInteger(java.math.BigInteger value) |
void |
writeIntegerAttribute(java.lang.String prefix,
java.lang.String nsURI,
java.lang.String localName,
java.math.BigInteger value) |
void |
writeLong(long value)
Write a long value to the output as textual element content.
|
void |
writeLongArray(long[] value,
int from,
int length) |
void |
writeLongArrayAttribute(java.lang.String prefix,
java.lang.String nsURI,
java.lang.String localName,
long[] value) |
void |
writeLongAttribute(java.lang.String prefix,
java.lang.String nsURI,
java.lang.String localName,
long value)
Write an long value to the output as attribute value.
|
void |
writeProcessingInstruction(java.lang.String target) |
void |
writeProcessingInstruction(java.lang.String target,
java.lang.String data) |
void |
writeQName(javax.xml.namespace.QName name) |
void |
writeQNameAttribute(java.lang.String prefix,
java.lang.String nsURI,
java.lang.String localName,
javax.xml.namespace.QName name) |
void |
writeRaw(char[] text,
int offset,
int length)
Method that writes specified content as is, without encoding or
deciphering it in any way.
|
void |
writeRaw(java.lang.String text)
Method that writes specified content as is, without encoding or
deciphering it in any way.
|
void |
writeRaw(java.lang.String text,
int start,
int offset)
Method that writes specified content as is, without encoding or
deciphering it in any way.
|
void |
writeSpace(char[] text,
int start,
int len)
Method that can be called to write whitespace-only content.
|
void |
writeSpace(java.lang.String text)
Method that can be called to write whitespace-only content.
|
void |
writeStartDocument() |
void |
writeStartDocument(java.lang.String version) |
void |
writeStartDocument(java.lang.String encoding,
java.lang.String version) |
void |
writeStartDocument(java.lang.String version,
java.lang.String encoding,
boolean standAlone) |
static final java.lang.String DEFAULT_OUTPUT_ENCODING
static final java.lang.String DEFAULT_XML_VERSION
protected final boolean mNsAware
protected final boolean mNsRepairing
protected java.lang.String mEncoding
protected javax.xml.namespace.NamespaceContext mNsContext
protected final org.w3c.dom.Document mDocument
protected SimpleValueEncoder mValueEncoder
protected DOMWrappingWriter(org.w3c.dom.Node treeRoot, boolean nsAware, boolean nsRepairing) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
public void close()
close
in interface javax.xml.stream.XMLStreamWriter
public void flush()
flush
in interface javax.xml.stream.XMLStreamWriter
public abstract javax.xml.namespace.NamespaceContext getNamespaceContext()
getNamespaceContext
in interface javax.xml.stream.XMLStreamWriter
public abstract java.lang.String getPrefix(java.lang.String uri)
getPrefix
in interface javax.xml.stream.XMLStreamWriter
public abstract java.lang.Object getProperty(java.lang.String name)
getProperty
in interface javax.xml.stream.XMLStreamWriter
public abstract void setDefaultNamespace(java.lang.String uri)
setDefaultNamespace
in interface javax.xml.stream.XMLStreamWriter
public void setNamespaceContext(javax.xml.namespace.NamespaceContext context)
setNamespaceContext
in interface javax.xml.stream.XMLStreamWriter
public abstract void setPrefix(java.lang.String prefix, java.lang.String uri) throws javax.xml.stream.XMLStreamException
setPrefix
in interface javax.xml.stream.XMLStreamWriter
javax.xml.stream.XMLStreamException
public abstract void writeAttribute(java.lang.String localName, java.lang.String value) throws javax.xml.stream.XMLStreamException
writeAttribute
in interface javax.xml.stream.XMLStreamWriter
javax.xml.stream.XMLStreamException
public abstract void writeAttribute(java.lang.String nsURI, java.lang.String localName, java.lang.String value) throws javax.xml.stream.XMLStreamException
writeAttribute
in interface javax.xml.stream.XMLStreamWriter
javax.xml.stream.XMLStreamException
public abstract void writeAttribute(java.lang.String prefix, java.lang.String nsURI, java.lang.String localName, java.lang.String value) throws javax.xml.stream.XMLStreamException
writeAttribute
in interface javax.xml.stream.XMLStreamWriter
javax.xml.stream.XMLStreamException
public void writeCData(java.lang.String data) throws javax.xml.stream.XMLStreamException
writeCData
in interface javax.xml.stream.XMLStreamWriter
javax.xml.stream.XMLStreamException
public void writeCharacters(char[] text, int start, int len) throws javax.xml.stream.XMLStreamException
writeCharacters
in interface javax.xml.stream.XMLStreamWriter
javax.xml.stream.XMLStreamException
public void writeCharacters(java.lang.String text) throws javax.xml.stream.XMLStreamException
writeCharacters
in interface javax.xml.stream.XMLStreamWriter
javax.xml.stream.XMLStreamException
public void writeComment(java.lang.String data) throws javax.xml.stream.XMLStreamException
writeComment
in interface javax.xml.stream.XMLStreamWriter
javax.xml.stream.XMLStreamException
public abstract void writeDefaultNamespace(java.lang.String nsURI) throws javax.xml.stream.XMLStreamException
writeDefaultNamespace
in interface javax.xml.stream.XMLStreamWriter
javax.xml.stream.XMLStreamException
public void writeDTD(java.lang.String dtd) throws javax.xml.stream.XMLStreamException
writeDTD
in interface javax.xml.stream.XMLStreamWriter
javax.xml.stream.XMLStreamException
public abstract void writeEmptyElement(java.lang.String localName) throws javax.xml.stream.XMLStreamException
writeEmptyElement
in interface javax.xml.stream.XMLStreamWriter
javax.xml.stream.XMLStreamException
public abstract void writeEmptyElement(java.lang.String nsURI, java.lang.String localName) throws javax.xml.stream.XMLStreamException
writeEmptyElement
in interface javax.xml.stream.XMLStreamWriter
javax.xml.stream.XMLStreamException
public abstract void writeEmptyElement(java.lang.String prefix, java.lang.String localName, java.lang.String nsURI) throws javax.xml.stream.XMLStreamException
writeEmptyElement
in interface javax.xml.stream.XMLStreamWriter
javax.xml.stream.XMLStreamException
public abstract void writeEndDocument() throws javax.xml.stream.XMLStreamException
writeEndDocument
in interface javax.xml.stream.XMLStreamWriter
javax.xml.stream.XMLStreamException
public void writeEntityRef(java.lang.String name) throws javax.xml.stream.XMLStreamException
writeEntityRef
in interface javax.xml.stream.XMLStreamWriter
javax.xml.stream.XMLStreamException
public void writeProcessingInstruction(java.lang.String target) throws javax.xml.stream.XMLStreamException
writeProcessingInstruction
in interface javax.xml.stream.XMLStreamWriter
javax.xml.stream.XMLStreamException
public void writeProcessingInstruction(java.lang.String target, java.lang.String data) throws javax.xml.stream.XMLStreamException
writeProcessingInstruction
in interface javax.xml.stream.XMLStreamWriter
javax.xml.stream.XMLStreamException
public void writeStartDocument() throws javax.xml.stream.XMLStreamException
writeStartDocument
in interface javax.xml.stream.XMLStreamWriter
javax.xml.stream.XMLStreamException
public void writeStartDocument(java.lang.String version) throws javax.xml.stream.XMLStreamException
writeStartDocument
in interface javax.xml.stream.XMLStreamWriter
javax.xml.stream.XMLStreamException
public void writeStartDocument(java.lang.String encoding, java.lang.String version) throws javax.xml.stream.XMLStreamException
writeStartDocument
in interface javax.xml.stream.XMLStreamWriter
javax.xml.stream.XMLStreamException
public XMLStreamLocation2 getLocation()
XMLStreamWriter2
getLocation
in interface XMLStreamWriter2
public java.lang.String getEncoding()
XMLStreamWriter2
XMLOutputFactory
writeStartDocument
method (explicitly
or implicity; latter in cases where defaults are imposed
by Stax specification)
getEncoding
in interface XMLStreamWriter2
public abstract boolean isPropertySupported(java.lang.String name)
XMLStreamWriter2
XMLOutputFactory.isPropertySupported(java.lang.String)
, used
to determine whether a property is supported by the Writer
instance. This means that this method may return false
for some properties that the output factory does support: specifically,
it should only return true if the value is mutable on per-instance
basis. False means that either the property is not recognized, or
is not mutable via writer instance.isPropertySupported
in interface XMLStreamWriter2
public abstract boolean setProperty(java.lang.String name, java.lang.Object value)
XMLStreamWriter2
XMLOutputFactory2
instance. Exactly which methods are mutable is implementation
specific.setProperty
in interface XMLStreamWriter2
name
- Name of the property to setvalue
- Value to set property to.public void writeCData(char[] text, int start, int len) throws javax.xml.stream.XMLStreamException
writeCData
in interface XMLStreamWriter2
javax.xml.stream.XMLStreamException
public abstract void writeDTD(java.lang.String rootName, java.lang.String systemId, java.lang.String publicId, java.lang.String internalSubset) throws javax.xml.stream.XMLStreamException
writeDTD
in interface XMLStreamWriter2
javax.xml.stream.XMLStreamException
public void writeFullEndElement() throws javax.xml.stream.XMLStreamException
XMLStreamWriter2
XMLStreamWriter.writeEndElement()
, but that will always
write the full end element, instead of empty element. This only
matters for cases where the element itself has no content, and
if writer is allowed to write empty elements when it encounters
such start/end element write pairs.writeFullEndElement
in interface XMLStreamWriter2
javax.xml.stream.XMLStreamException
public void writeSpace(char[] text, int start, int len) throws javax.xml.stream.XMLStreamException
XMLStreamWriter2
This method is useful for things like outputting indentation.
writeSpace
in interface XMLStreamWriter2
javax.xml.stream.XMLStreamException
public void writeSpace(java.lang.String text) throws javax.xml.stream.XMLStreamException
XMLStreamWriter2
This method is useful for things like outputting indentation.
writeSpace
in interface XMLStreamWriter2
javax.xml.stream.XMLStreamException
public void writeStartDocument(java.lang.String version, java.lang.String encoding, boolean standAlone) throws javax.xml.stream.XMLStreamException
writeStartDocument
in interface XMLStreamWriter2
javax.xml.stream.XMLStreamException
public XMLValidator validateAgainst(XMLValidationSchema schema) throws javax.xml.stream.XMLStreamException
Validatable
XMLValidator
instance from the
given schema (unless a validator for that schema has already been
added),
initialize it if necessary, and make validatable object (reader,
writer)
call appropriate validation methods from this point on until the
end of the document (that is, it's not scoped with sub-trees), or until
validator is removed by an explicit call to
Validatable.stopValidatingAgainst(org.codehaus.stax2.validation.XMLValidationSchema)
.
Note that while this method can be called at any point in output processing, validator instances are not required to be able to handle addition at other points than right before outputting the root element.
validateAgainst
in interface Validatable
javax.xml.stream.XMLStreamException
public XMLValidator stopValidatingAgainst(XMLValidationSchema schema) throws javax.xml.stream.XMLStreamException
Validatable
Validatable.validateAgainst(org.codehaus.stax2.validation.XMLValidationSchema)
was called earlier.stopValidatingAgainst
in interface Validatable
javax.xml.stream.XMLStreamException
public XMLValidator stopValidatingAgainst(XMLValidator validator) throws javax.xml.stream.XMLStreamException
Validatable
Validatable.validateAgainst(org.codehaus.stax2.validation.XMLValidationSchema)
.
Note: the specified validator is compared for identity with validators in use, not for equality.
stopValidatingAgainst
in interface Validatable
validator
)
if it was being used for validating current document; null if not.javax.xml.stream.XMLStreamException
public ValidationProblemHandler setValidationProblemHandler(ValidationProblemHandler h)
Validatable
setValidationProblemHandler
in interface Validatable
h
- Handler to install, if non null; if null, indicates that
the default (implementation-specific) handling should be usedpublic void writeRaw(java.lang.String text) throws javax.xml.stream.XMLStreamException
XMLStreamWriter2
Method is usually used when encapsulating output from another writer as a sub-tree, or when passing through XML fragments.
NOTE: since text to be written may be anything, including markup, it can not be reliably validated. Because of this, validator(s) attached to the writer will NOT be informed about writes.
writeRaw
in interface XMLStreamWriter2
javax.xml.stream.XMLStreamException
public void writeRaw(java.lang.String text, int start, int offset) throws javax.xml.stream.XMLStreamException
XMLStreamWriter2
Method is usually used when encapsulating output from another writer as a sub-tree, or when passing through XML fragments.
NOTE: since text to be written may be anything, including markup, it can not be reliably validated. Because of this, validator(s) attached to the writer will NOT be informed about writes.
writeRaw
in interface XMLStreamWriter2
javax.xml.stream.XMLStreamException
public void writeRaw(char[] text, int offset, int length) throws javax.xml.stream.XMLStreamException
XMLStreamWriter2
Method is usually used when encapsulating output from another writer as a sub-tree, or when passing through XML fragments.
NOTE: since text to be written may be anything, including markup, it can not be reliably validated. Because of this, validator(s) attached to the writer will NOT be informed about writes.
writeRaw
in interface XMLStreamWriter2
javax.xml.stream.XMLStreamException
public void copyEventFromReader(XMLStreamReader2 r, boolean preserveEventData) throws javax.xml.stream.XMLStreamException
XMLStreamWriter2
copyEventFromReader
in interface XMLStreamWriter2
r
- Reader to use for accessing event to copypreserveEventData
- If true, writer is not allowed to change
the state of the reader (so that all the data associated with the
current event has to be preserved); if false, writer is allowed
to use methods that may cause some data to be discarded. Setting
this to false may improve the performance, since it may allow
full no-copy streaming of data, especially textual contents.javax.xml.stream.XMLStreamException
public void closeCompletely()
XMLStreamWriter2
XMLStreamWriter.close()
,
except that this method also does close the underlying output
destination (stream) if it has not yet been closed.
It is specifically necessary to call this method if the parsing ends
in an exception to ensure that the output destination does get
properly closed, even if the stream writer would otherwise close
it (as is the case for destinations it manages where calling
application has no access)closeCompletely
in interface XMLStreamWriter2
public void writeBoolean(boolean value) throws javax.xml.stream.XMLStreamException
TypedXMLStreamWriter
writeBoolean
in interface TypedXMLStreamWriter
value
- The boolean value to write.javax.xml.stream.XMLStreamException
public void writeInt(int value) throws javax.xml.stream.XMLStreamException
TypedXMLStreamWriter
writeInt
in interface TypedXMLStreamWriter
javax.xml.stream.XMLStreamException
public void writeLong(long value) throws javax.xml.stream.XMLStreamException
TypedXMLStreamWriter
writeLong
in interface TypedXMLStreamWriter
javax.xml.stream.XMLStreamException
public void writeFloat(float value) throws javax.xml.stream.XMLStreamException
TypedXMLStreamWriter
writeFloat
in interface TypedXMLStreamWriter
javax.xml.stream.XMLStreamException
public void writeDouble(double value) throws javax.xml.stream.XMLStreamException
TypedXMLStreamWriter
writeDouble
in interface TypedXMLStreamWriter
javax.xml.stream.XMLStreamException
public void writeInteger(java.math.BigInteger value) throws javax.xml.stream.XMLStreamException
writeInteger
in interface TypedXMLStreamWriter
javax.xml.stream.XMLStreamException
public void writeDecimal(java.math.BigDecimal value) throws javax.xml.stream.XMLStreamException
TypedXMLStreamWriter
writeDecimal
in interface TypedXMLStreamWriter
javax.xml.stream.XMLStreamException
public void writeQName(javax.xml.namespace.QName name) throws javax.xml.stream.XMLStreamException
writeQName
in interface TypedXMLStreamWriter
javax.xml.stream.XMLStreamException
public void writeIntArray(int[] value, int from, int length) throws javax.xml.stream.XMLStreamException
TypedXMLStreamWriter
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.
writeIntArray
in interface TypedXMLStreamWriter
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.javax.xml.stream.XMLStreamException
public void writeLongArray(long[] value, int from, int length) throws javax.xml.stream.XMLStreamException
writeLongArray
in interface TypedXMLStreamWriter
javax.xml.stream.XMLStreamException
public void writeFloatArray(float[] value, int from, int length) throws javax.xml.stream.XMLStreamException
writeFloatArray
in interface TypedXMLStreamWriter
javax.xml.stream.XMLStreamException
public void writeDoubleArray(double[] value, int from, int length) throws javax.xml.stream.XMLStreamException
writeDoubleArray
in interface TypedXMLStreamWriter
javax.xml.stream.XMLStreamException
public void writeBinary(byte[] value, int from, int length) throws javax.xml.stream.XMLStreamException
TypedXMLStreamWriter
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
.
writeBinary
in interface TypedXMLStreamWriter
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.javax.xml.stream.XMLStreamException
public void writeBinary(Base64Variant v, byte[] value, int from, int length) throws javax.xml.stream.XMLStreamException
writeBinary
in interface TypedXMLStreamWriter
javax.xml.stream.XMLStreamException
public void writeBooleanAttribute(java.lang.String prefix, java.lang.String nsURI, java.lang.String localName, boolean value) throws javax.xml.stream.XMLStreamException
TypedXMLStreamWriter
writeBooleanAttribute
in interface TypedXMLStreamWriter
prefix
- The attribute's prefix. Null or "" if no prefix is to be usednsURI
- The attribute's URI (can be either null or empty String for "no namespace")localName
- The attribute's local namevalue
- The boolean value to write.javax.xml.stream.XMLStreamException
public void writeIntAttribute(java.lang.String prefix, java.lang.String nsURI, java.lang.String localName, int value) throws javax.xml.stream.XMLStreamException
TypedXMLStreamWriter
writeIntAttribute
in interface TypedXMLStreamWriter
prefix
- The attribute's prefix. Null or "" if no prefix is to be usednsURI
- The attribute's URI (can be either null or empty String for "no namespace")localName
- The attribute's local namevalue
- The integer value to write.javax.xml.stream.XMLStreamException
public void writeLongAttribute(java.lang.String prefix, java.lang.String nsURI, java.lang.String localName, long value) throws javax.xml.stream.XMLStreamException
TypedXMLStreamWriter
writeLongAttribute
in interface TypedXMLStreamWriter
prefix
- The attribute's prefix. Null or "" if no prefix is to be usednsURI
- The attribute's URI (can be either null or empty String for "no namespace")localName
- The attribute's local namevalue
- The long value to write.javax.xml.stream.XMLStreamException
public void writeFloatAttribute(java.lang.String prefix, java.lang.String nsURI, java.lang.String localName, float value) throws javax.xml.stream.XMLStreamException
writeFloatAttribute
in interface TypedXMLStreamWriter
javax.xml.stream.XMLStreamException
public void writeDoubleAttribute(java.lang.String prefix, java.lang.String nsURI, java.lang.String localName, double value) throws javax.xml.stream.XMLStreamException
writeDoubleAttribute
in interface TypedXMLStreamWriter
javax.xml.stream.XMLStreamException
public void writeIntegerAttribute(java.lang.String prefix, java.lang.String nsURI, java.lang.String localName, java.math.BigInteger value) throws javax.xml.stream.XMLStreamException
writeIntegerAttribute
in interface TypedXMLStreamWriter
javax.xml.stream.XMLStreamException
public void writeDecimalAttribute(java.lang.String prefix, java.lang.String nsURI, java.lang.String localName, java.math.BigDecimal value) throws javax.xml.stream.XMLStreamException
writeDecimalAttribute
in interface TypedXMLStreamWriter
javax.xml.stream.XMLStreamException
public void writeQNameAttribute(java.lang.String prefix, java.lang.String nsURI, java.lang.String localName, javax.xml.namespace.QName name) throws javax.xml.stream.XMLStreamException
writeQNameAttribute
in interface TypedXMLStreamWriter
javax.xml.stream.XMLStreamException
public void writeIntArrayAttribute(java.lang.String prefix, java.lang.String nsURI, java.lang.String localName, int[] value) throws javax.xml.stream.XMLStreamException
TypedXMLStreamWriter
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.
writeIntArrayAttribute
in interface TypedXMLStreamWriter
prefix
- The attribute's prefix.nsURI
- The attribute's URI.localName
- The attribute's local name.value
- The array from which to write the ints.javax.xml.stream.XMLStreamException
public void writeLongArrayAttribute(java.lang.String prefix, java.lang.String nsURI, java.lang.String localName, long[] value) throws javax.xml.stream.XMLStreamException
writeLongArrayAttribute
in interface TypedXMLStreamWriter
javax.xml.stream.XMLStreamException
public void writeFloatArrayAttribute(java.lang.String prefix, java.lang.String nsURI, java.lang.String localName, float[] value) throws javax.xml.stream.XMLStreamException
writeFloatArrayAttribute
in interface TypedXMLStreamWriter
javax.xml.stream.XMLStreamException
public void writeDoubleArrayAttribute(java.lang.String prefix, java.lang.String nsURI, java.lang.String localName, double[] value) throws javax.xml.stream.XMLStreamException
writeDoubleArrayAttribute
in interface TypedXMLStreamWriter
javax.xml.stream.XMLStreamException
public void writeBinaryAttribute(java.lang.String prefix, java.lang.String nsURI, java.lang.String localName, byte[] value) throws javax.xml.stream.XMLStreamException
TypedXMLStreamWriter
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
.
writeBinaryAttribute
in interface TypedXMLStreamWriter
prefix
- The attribute's prefix.nsURI
- The attribute's URI.localName
- The attribute's local name.value
- The array from which to write the bytes.javax.xml.stream.XMLStreamException
public void writeBinaryAttribute(Base64Variant v, java.lang.String prefix, java.lang.String nsURI, java.lang.String localName, byte[] value) throws javax.xml.stream.XMLStreamException
writeBinaryAttribute
in interface TypedXMLStreamWriter
javax.xml.stream.XMLStreamException
protected abstract void appendLeaf(org.w3c.dom.Node n) throws java.lang.IllegalStateException
java.lang.IllegalStateException
protected java.lang.String serializeQNameValue(javax.xml.namespace.QName name) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
protected SimpleValueEncoder getValueEncoder()
protected static void throwOutputError(java.lang.String msg) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
protected static void throwOutputError(java.lang.String format, java.lang.Object arg) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException
protected void reportUnsupported(java.lang.String operName)