public class ConfXMLParamToXML extends Object
ConfXMLParam[]
which represents a XML-fragment to a equivalent
DOM (org.w3c.dom.Document
) or to a string
XML representation.
A fragment refer to part of a XML document that may be useful to use interchange in the absence of the rest of the XML document.
A fragment must be well-balanced and may or may not contain a surrounding root element. In either case a root element will always be created and it will always be the documents direct descendant node.
The parent tag may be supplied or omitted. If omitted a root element will be created with the name "fragment" without any namespace.
<fragment> ... </fragment>
Constructor and Description |
---|
ConfXMLParamToXML() |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears the state of the instance of this class which permits
multiple invocation of
ConfXMLParamToXML.toXML(ConfXMLParam[],boolean) . |
void |
serialize(Document doc,
OutputStream out)
Flushes the source document
doc to
the target out . |
void |
serialize(Document doc,
Writer out)
Flushes the source document
doc to
the target out |
Document |
toXML(ConfXMLParam[] param)
Transforms the supplied parameter
ConfXMLParam[]
to a document (Document ). |
Document |
toXML(ConfXMLParam[] param,
boolean includeEmpty)
Transforms the supplied parameter
ConfXMLParam[]
to a document (Document ). |
Document |
toXML(ConfXMLParam[] param,
String parentNode,
String parentURI)
Transforms the supplied
ConfXMLParam[]
to a document (Document ). |
Document |
toXML(ConfXMLParam[] param,
String parentNode,
String parentURI,
boolean includeEmpty)
Transforms the supplied parameter
ConfXMLParam[]
to a document (Document ). |
public void clear()
ConfXMLParamToXML.toXML(ConfXMLParam[],boolean)
.public Document toXML(ConfXMLParam[] param, boolean includeEmpty) throws ConfException
ConfXMLParam[]
to a document (Document
).
The root
tag which encloses the structure will be set
to a dummy tag fragment.
<fragment> ... </fragment>
If another root tag is desired use the method
ConfXMLParamToXML.toXML(ConfXMLParam[],String,String)
where
root tag name
and namespace uri
string
could be supplied and will
be the root Node of the returning Document
.
param
- The target array to be convertedincludeEmpty
- Include empty leaf values
as ConfNoExists.toString()
Document
If
- some error occurredConfException
public Document toXML(ConfXMLParam[] param) throws ConfException
ConfXMLParam[]
to a document (Document
).
The root
tag which encloses the structure will be set
to a dummy tag fragment.
<fragment> ... </fragment>
If another root tag is desired use the method
ConfXMLParamToXML.toXML(ConfXMLParam[],String,String)
where
root tag name
and namespace uri
string
could be supplied and will be the root Node of the Document.
Excludes tags with empty leaf values from the document.
param
- The source ConfXMLParam[]
array to
be converted to the equivalent documentDocument
If
- some error occurredConfException
public Document toXML(ConfXMLParam[] param, String parentNode, String parentURI, boolean includeEmpty) throws ConfException
ConfXMLParam[]
to a document (Document
).param
- The source ConfXMLParam[]
to be converted to the equivalent documentparentNode
- the parent tag that should be the
the parent node of the source array.parentURI
- the namespace uri that the parentNode belongs toincludeEmpty
- Include empty leaf values as ConfNoExists.toString()
ConfException
- if error occurredpublic Document toXML(ConfXMLParam[] param, String parentNode, String parentURI) throws ConfException
ConfXMLParam[]
to a document (Document
).
Excludes tags with empty leaf values from the resulting document.param
- The source ConfXMLParam
structure
(tag value array) to be converted to a documentparentNode
- the parent tag that should be the
the parent node of the source array.parentURI
- the namespace uri that the parentNode belongs toConfException
- if a error occurredpublic void serialize(Document doc, OutputStream out) throws ConfException
doc
to
the target out
.doc
- The source documentout
- The destination streamConfException
- if occurred while flushing the documentpublic void serialize(Document doc, Writer out) throws ConfException
doc
to
the target out
doc
- The source documentout
- The destination writerConfException
- if occurred while flushing the document