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 org..
Alas it is hard to reuse it without cut'n pasting.
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final String | |
| pack-priv static final String | |
| protected final Document | mDocument
We need a reference to the document hosting nodes to be able to create new nodes |
| protected 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 final boolean | |
| protected NamespaceContext | mNsContext
If we are being given info about existing bindings, it'll come as a NamespaceContext. |
| protected final boolean | |
| protected SimpleValueEncoder | mValueEncoder
Encoding of typed values is used the standard encoder included in RI. |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| protected abstract void | |
| public void | close()
Implements javax. |
| public void | closeCompletely()
Implements org. javax.,
except that this method also does close the underlying output
destination (stream) if it has not yet been closed.
|
| public void | copyEventFromReader(XMLStreamReader2
Reader to use for accessing event to copy r, boolean 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. preserveEventData)Implements org. |
| public void | flush()
Implements javax. |
| public String | getEncoding()
Implements org. |
| public XMLStreamLocation2 | getLocation()
Implements org. |
| public abstract NamespaceContext | getNamespaceContext()
Redeclares javax. |
| public abstract String | getPrefix(String
the uri the prefix is bound to uri)Redeclares javax. |
| public abstract Object | getProperty(String
The name of the property, may not be null name)Redeclares javax. |
| protected SimpleValueEncoder | |
| public abstract boolean | isPropertySupported(String name)
Redeclares org. javax., used
to determine whether a property is supported by the Writer
instance.
|
| protected void | |
| protected String | serializeQNameValue(QName name)
Method called to serialize given qualified name into valid String serialization, taking into account existing namespace bindings. |
| public abstract void | setDefaultNamespace(String
the uri to bind to the default namespace, may be null uri)Redeclares javax. |
| public void | setNamespaceContext(NamespaceContext
the namespace context to use for this writer, may not be null context)Implements javax. |
| public abstract void | setPrefix(String
the prefix to bind to the uri, may not be null prefix, String the uri to bind to the prefix, may be null uri)Redeclares javax. |
| public abstract boolean | setProperty(String
Name of the property to set name, Object Value to set property to. value)Redeclares org. org.
instance.
|
| public ValidationProblemHandler | setValidationProblemHandler(ValidationProblemHandler
Handler to install, if non null; if null, indicates that
the default (implementation-specific) handling should be used h)Implements org. |
| public XMLValidator | stopValidatingAgainst(XMLValidationSchema schema)
Implements org. validateAgainst
was called earlier.
|
| public XMLValidator | stopValidatingAgainst(XMLValidator validator)
Implements org. |
| protected static void | |
| protected static void | |
| public XMLValidator | validateAgainst(XMLValidationSchema schema)
Implements org. 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
stopValidatingAgainst.
|
| public abstract void | writeAttribute(String
the local name of the attribute localName, String the value of the attribute value)Redeclares javax. |
| public abstract void | writeAttribute(String
the uri of the prefix for this attribute nsURI, String the local name of the attribute localName, String the value of the attribute value)Redeclares javax. |
| public abstract void | writeAttribute(String
the prefix for this attribute prefix, String the uri of the prefix for this attribute nsURI, String the local name of the attribute localName, String the value of the attribute value)Redeclares javax. |
| 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)Implements org. Write binary content as base64 encoded characters to the output. |
| public void | writeBinary(Base64Variant v, byte[] value, int from, int length)
Implements org. |
| public void | writeBinaryAttribute(String
The attribute's prefix. prefix, String The attribute's URI. nsURI, String The attribute's local name. localName, byte[] The array from which to write the bytes. value)Implements org. Write a byte array attribute. |
| public void | writeBinaryAttribute(Base64Variant v, String prefix, String nsURI, String localName, byte[] value)
Implements org. |
| public void | writeBoolean(boolean
The boolean value to write. value)Implements org. |
| 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") nsURI, String The attribute's local name localName, boolean The boolean value to write. value)Implements org. |
| public void | writeCData(String
the data contained in the CData Section, may not be null data)Implements javax. |
| public void | writeCData(char[] text, int start, int len)
Implements org. |
| public void | writeCharacters(char[]
the value to write text, int the starting position in the array start, int the number of characters to write len)Implements javax. |
| public void | writeCharacters(String
the value to write text)Implements javax. |
| public void | writeComment(String
the data contained in the comment, may be null data)Implements javax. |
| public void | writeDecimal(BigDecimal value)
Implements org. |
| public void | writeDecimalAttribute(String prefix, String nsURI, String localName, BigDecimal value)
Implements org. |
| public abstract void | writeDefaultNamespace(String
the uri to bind the default namespace to nsURI)Redeclares javax. |
| public void | writeDouble(double value)
Implements org. |
| public void | writeDoubleArray(double[] value, int from, int length)
Implements org. |
| public void | writeDoubleArrayAttribute(String prefix, String nsURI, String localName, double[] value)
Implements org. |
| public void | writeDoubleAttribute(String prefix, String nsURI, String localName, double value)
Implements org. |
| public void | writeDTD(String
the DTD to be written dtd)Implements javax. |
| public abstract void | |
| public abstract void | writeEmptyElement(String
local name of the tag, may not be null localName)Redeclares javax. |
| public abstract void | writeEmptyElement(String
the uri to bind the tag to, may not be null nsURI, String local name of the tag, may not be null localName)Redeclares javax. |
| public abstract void | writeEmptyElement(String
the prefix of the tag, may not be null prefix, String local name of the tag, may not be null localName, String the uri to bind the tag to, may not be null nsURI)Redeclares javax. |
| public abstract void | writeEndDocument()
Redeclares javax. |
| public void | writeEntityRef(String
the name of the entity name)Implements javax. |
| public void | writeFloat(float value)
Implements org. |
| public void | writeFloatArray(float[] value, int from, int length)
Implements org. |
| public void | writeFloatArrayAttribute(String prefix, String nsURI, String localName, float[] value)
Implements org. |
| public void | writeFloatAttribute(String prefix, String nsURI, String localName, float value)
Implements org. |
| public void | writeFullEndElement()
Implements org. writeEndElement, but that will always
write the full end element, instead of empty element.
|
| public void | writeInt(int value)
Implements org. |
| 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)Implements org. Write int array to the output. |
| public void | writeIntArrayAttribute(String
The attribute's prefix. prefix, String The attribute's URI. nsURI, String The attribute's local name. localName, int[] The array from which to write the ints. value)Implements org. 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") nsURI, String The attribute's local name localName, int The integer value to write. value)Implements org. |
| public void | writeInteger(BigInteger value)
Implements org. |
| public void | writeIntegerAttribute(String prefix, String nsURI, String localName, BigInteger value)
Implements org. |
| public void | writeLong(long value)
Implements org. |
| public void | writeLongArray(long[] value, int from, int length)
Implements org. |
| public void | writeLongArrayAttribute(String prefix, String nsURI, String localName, long[] value)
Implements org. |
| 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") nsURI, String The attribute's local name localName, long The long value to write. value)Implements org. |
| public void | writeProcessingInstruction(String
the target of the processing instruction, may not be null target)Implements javax. |
| public void | writeProcessingInstruction(String
the target of the processing instruction, may not be null target, String the data contained in the processing instruction, may not be null data)Implements javax. |
| public void | |
| public void | writeQNameAttribute(String prefix, String nsURI, String localName, QName name)
Implements org. |
| public void | writeRaw(String text)
Implements org. |
| public void | writeRaw(String text, int start, int offset)
Implements org. |
| public void | writeRaw(char[] text, int offset, int length)
Implements org. |
| public void | writeSpace(char[] text, int start, int len)
Implements org. |
| public void | writeSpace(String text)
Implements org. |
| public void | writeStartDocument()
Implements javax. |
| public void | writeStartDocument(String
version of the xml document version)Implements javax. |
| public void | writeStartDocument(String
encoding of the xml declaration encoding, String version of the xml document version)Implements javax. |
| public void | writeStartDocument(String version, String encoding, boolean standAlone)
Implements org. |