public interface OMSerializable extends OMInformationItem
OMDocument and OMNode.
Note that OMAttribute and OMNamespace are information items that don't
match the definition of this interface because they can only be read from the parser
as part of a larger unit, namely an element.
In accordance with the definition given above, this interface declares two sets of methods:
XMLStreamWriter.| Modifier and Type | Method and Description |
|---|---|
void |
build()
Builds itself.
|
void |
close(boolean build)
If a builder and parser is associated with the node, it is closed.
|
boolean |
isComplete()
Indicates whether parser has parsed this information item completely or not.
|
void |
serialize(javax.xml.stream.XMLStreamWriter xmlWriter)
Serializes the information item with caching.
|
void |
serialize(javax.xml.stream.XMLStreamWriter xmlWriter,
boolean cache)
Serializes the information item to the given
XMLStreamWriter. |
void |
serializeAndConsume(javax.xml.stream.XMLStreamWriter xmlWriter)
Serializes the information item without caching.
|
clone, getOMFactoryboolean isComplete()
void build()
void close(boolean build)
build - if true, the object is built first before closing the builder/parservoid serialize(javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException
serialize(XMLStreamWriter, boolean) with cache set to
true.xmlWriter - javax.xml.stream.XMLStreamExceptionvoid serializeAndConsume(javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException
serialize(XMLStreamWriter, boolean) with cache set to
false.xmlWriter - javax.xml.stream.XMLStreamExceptionvoid serialize(javax.xml.stream.XMLStreamWriter xmlWriter, boolean cache) throws javax.xml.stream.XMLStreamException
XMLStreamWriter.
The implementation of this method must satisfy the following requirements:
DataHandlerWriter extension, then base64 binary data
MUST be written using one of the methods defined by that extension. This will occur if the
information item is an OMText node for which OMText.isBinary() returns
true or if it is an OMContainer that has such an OMText node as
descendant. If the writer doesn't expose the DataHandlerWriter extension, then the
implementation MUST use XMLStreamWriter.writeCharacters(String) or
XMLStreamWriter.writeCharacters(char[], int, int) to write the base64 encoded data to
the stream.
XMLStreamWriter.writeNamespace(String, String) and
XMLStreamWriter.writeDefaultNamespace(String). This requirement is always applicable,
even if the method is used to serialize a subtree or if the object model is not well formed
with respect to namespaces. This means that the implementation is expected to implement
namespace repairing and that the implementation MUST NOT assume that the
XMLStreamWriter supplied by the caller performs any kind of namespace repairing.
XMLStreamWriter.getPrefix(String) and/or
XMLStreamWriter.getNamespaceContext() to query the pre-existing namespace context.
On the other hand, the caller of this method must ensure that the following requirements are satisfied:
XMLStreamWriter.getPrefix(String)
and XMLStreamWriter.getNamespaceContext() MUST accurately reflect the actual
namespace context at the location in the output document where the information item is
serialized. In practice this requirement means that if the caller writes content to the
XMLStreamWriter before calling this method, then it must use
XMLStreamWriter.setPrefix(String, String) and
XMLStreamWriter.setDefaultNamespace(String) to update the namespace context. Note
that this requirement may be relaxed if the caller implements some form of namespace
repairing.
xmlWriter - cache - indicates if caching should be enabledjavax.xml.stream.XMLStreamExceptionCopyright © The Apache Software Foundation. All Rights Reserved.