Class ConfXMLParamToXML
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clears the state of the instance of this class which permits multiple invocation oftoXML(ConfXMLParam[],boolean)
.void
serialize
(Document doc, OutputStream out) Flushes the source documentdoc
to the targetout
.void
Flushes the source documentdoc
to the targetout
toXML
(ConfXMLParam[] param) Transforms the supplied parameterConfXMLParam[]
to a document (Document
).toXML
(ConfXMLParam[] param, boolean includeEmpty) Transforms the supplied parameterConfXMLParam[]
to a document (Document
).toXML
(ConfXMLParam[] param, String parentNode, String parentURI) Transforms the suppliedConfXMLParam[]
to a document (Document
).toXML
(ConfXMLParam[] param, String parentNode, String parentURI, boolean includeEmpty) Transforms the supplied parameterConfXMLParam[]
to a document (Document
).
-
Constructor Details
-
ConfXMLParamToXML
public ConfXMLParamToXML()
-
-
Method Details
-
clear
public void clear()Clears the state of the instance of this class which permits multiple invocation oftoXML(ConfXMLParam[],boolean)
. -
toXML
Transforms the supplied parameterConfXMLParam[]
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
toXML(ConfXMLParam[],String,String)
where root tagname
and namespaceuri
string could be supplied and will be the root Node of the returningDocument
.- Parameters:
param
- The target array to be convertedincludeEmpty
- Include empty leaf values asConfNoExists.toString()
- Returns:
- The resulting
Document
- Throws:
ConfException
- If some error occurred
-
toXML
Transforms the supplied parameterConfXMLParam[]
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
toXML(ConfXMLParam[],String,String)
where root tagname
and namespaceuri
string could be supplied and will be the root Node of the Document.Excludes tags with empty leaf values from the document.
- Parameters:
param
- The sourceConfXMLParam[]
array to be converted to the equivalent document- Returns:
- The resulting
Document
- Throws:
ConfException
- If some error occurred
-
toXML
public Document toXML(ConfXMLParam[] param, String parentNode, String parentURI, boolean includeEmpty) throws ConfException Transforms the supplied parameterConfXMLParam[]
to a document (Document
).- Parameters:
param
- The sourceConfXMLParam[]
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 asConfNoExists.toString()
- Throws:
ConfException
- if error occurred
-
toXML
public Document toXML(ConfXMLParam[] param, String parentNode, String parentURI) throws ConfException Transforms the suppliedConfXMLParam[]
to a document (Document
). Excludes tags with empty leaf values from the resulting document.- Parameters:
param
- The sourceConfXMLParam
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 to- Throws:
ConfException
- if a error occurred
-
serialize
Flushes the source documentdoc
to the targetout
.- Parameters:
doc
- The source documentout
- The destination stream- Throws:
ConfException
- if occurred while flushing the document
-
serialize
Flushes the source documentdoc
to the targetout
- Parameters:
doc
- The source documentout
- The destination writer- Throws:
ConfException
- if occurred while flushing the document
-