|
Qizx/Open v0.4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.xfra.qizxopen.dm.XMLEventReceiverBase | +--net.xfra.qizxopen.dm.XMLSerializer
Serializes a DataModel Node and its subtree to an output stream. Supports several output methods: XML, XHTML, HTML, and TEXT.
A Serializer is first instantiated, then several options can be defined through
setOption(java.lang.String, java.lang.String)
, including the output method. An output stream can be specified
with setOutput(java.io.OutputStream, java.lang.String)
.
To serialize a node, use the output(Node)
method.
Field Summary | |
static java.lang.String |
DOCTYPE_PUBLIC
|
static java.lang.String |
DOCTYPE_SYSTEM
|
static java.lang.String |
ENCODING
|
static java.lang.String |
ESCAPE_URI_ATTRIBUTES
|
static java.lang.String |
INCLUDE_CONTENT_TYPE
|
static java.lang.String |
INDENT
|
static java.lang.String |
INDENT_VALUE
|
static java.lang.String |
MEDIA_TYPE
|
static java.lang.String |
METHOD
|
static java.lang.String |
OMIT_XML_DECLARATION
|
static java.lang.String |
STANDALONE
|
static java.lang.String |
VERSION
|
Constructor Summary | |
XMLSerializer()
Constructs a XMLSerializer with default XML output method. |
|
XMLSerializer(java.lang.String method)
Constructs a XMLSerializer with specification of an output method. |
|
XMLSerializer(java.io.Writer output)
Constructs a XMLSerializer with an output writer. |
Method Summary | |
void |
atom(java.lang.String value)
Text of an atom. |
void |
comment(java.lang.String value)
A comment node. |
void |
endDocument()
Ends a document. |
void |
endElement(QName name)
Ends an element. |
java.lang.String |
getEncoding()
Returns the current encoding. |
java.io.BufferedWriter |
getOutput()
Gets the current output as a Bufferedriter. |
void |
output(Node node)
Serializes a node and its subtree. |
void |
pi(java.lang.String target,
java.lang.String value)
A processing-instruction node. |
void |
reset()
[internal: implementation of interface XMLEventReceiver] Prepares the serialization of another tree. |
void |
setDepth(int maxDepth)
Extension: defines a maximum tree depth. |
void |
setIndent(int indent)
Extension: defines the number of spaces used for one level of indentation. |
void |
setOption(java.lang.String option,
java.lang.String value)
Sets an option. |
void |
setOutput(java.io.OutputStream output,
java.lang.String encoding)
Defines or redefines the output. |
void |
setOutput(java.io.Writer output)
Defines or redefines the output. |
void |
startDocument()
Starts a document. |
void |
terminate()
[internal: implementation of interface XMLEventReceiver] |
void |
text(java.lang.String value)
Text chunk inside an element. |
void |
traverse(Node node)
Lower-level output method. |
Methods inherited from class net.xfra.qizxopen.dm.XMLEventReceiverBase |
attribute, definePrefixHints, maxVolumeReached, namespace, resolvePrefix, setMaxVolume, setTrace, startElement, traverse |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String METHOD
public static final java.lang.String ENCODING
public static final java.lang.String VERSION
public static final java.lang.String OMIT_XML_DECLARATION
public static final java.lang.String STANDALONE
public static final java.lang.String DOCTYPE_SYSTEM
public static final java.lang.String DOCTYPE_PUBLIC
public static final java.lang.String MEDIA_TYPE
public static final java.lang.String ESCAPE_URI_ATTRIBUTES
public static final java.lang.String INCLUDE_CONTENT_TYPE
public static final java.lang.String INDENT
public static final java.lang.String INDENT_VALUE
Constructor Detail |
public XMLSerializer()
public XMLSerializer(java.lang.String method) throws DataModelException
method
- output method name (case-insensitive): XML, XHTML, HTML, or TEXT.
DataModelException
- when the method name is invalid.public XMLSerializer(java.io.Writer output)
output
- an open Writer, does not need to be buffered.Method Detail |
public void output(Node node) throws DataModelException
node
- node to serialize. If it is not a document, the XML header is not
generated.
DataModelException
public void setOutput(java.io.OutputStream output, java.lang.String encoding)
public void setOutput(java.io.Writer output)
public java.io.BufferedWriter getOutput()
public void setOption(java.lang.String option, java.lang.String value) throws DataModelException
Supported options:
option
- name of the option (see above).value
- option value in string form.
DataModelException
- on bad option name or value.public void setDepth(int maxDepth)
public void setIndent(int indent)
public java.lang.String getEncoding()
The encoding can have been defined by setOutput or by setOption.
public void traverse(Node node) throws DataModelException
DataModelException
public void reset()
Prepares the serialization of another tree.
reset
in interface XMLEventReceiver
reset
in class XMLEventReceiverBase
public void terminate() throws DataModelException
terminate
in interface XMLEventReceiver
terminate
in class XMLEventReceiverBase
DataModelException
public void startDocument() throws DataModelException
XMLEventReceiver
It is not called in the case only a fragment is generated.
startDocument
in interface XMLEventReceiver
startDocument
in class XMLEventReceiverBase
DataModelException
public void endDocument() throws DataModelException
XMLEventReceiver
endDocument
in interface XMLEventReceiver
endDocument
in class XMLEventReceiverBase
DataModelException
public void endElement(QName name) throws DataModelException
XMLEventReceiver
endElement
in interface XMLEventReceiver
endElement
in class XMLEventReceiverBase
DataModelException
public void text(java.lang.String value)
XMLEventReceiver
public void atom(java.lang.String value)
XMLEventReceiver
public void pi(java.lang.String target, java.lang.String value)
XMLEventReceiver
public void comment(java.lang.String value)
XMLEventReceiver
|
Copyright Xavier FRANC 2003-2004 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |