Class ConfXMLParamToXML

Object
com.tailf.util.ConfXMLParamToXML

public class ConfXMLParamToXML extends Object
Utility class to transform 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>
 
See Also:
  • Constructor Details

    • ConfXMLParamToXML

      public ConfXMLParamToXML()
  • Method Details

    • clear

      public void clear()
      Clears the state of the instance of this class which permits multiple invocation of toXML(ConfXMLParam[],boolean).
    • toXML

      public Document toXML(ConfXMLParam[] param, boolean includeEmpty) throws ConfException
      Transforms the supplied parameter 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 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.

      Parameters:
      param - The target array to be converted
      includeEmpty - Include empty leaf values as ConfNoExists.toString()
      Returns:
      The resulting Document
      Throws:
      ConfException - If some error occurred
    • toXML

      public Document toXML(ConfXMLParam[] param) throws ConfException
      Transforms the supplied parameter 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 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.

      Parameters:
      param - The source ConfXMLParam[] 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 parameter ConfXMLParam[] to a document (Document).
      Parameters:
      param - The source ConfXMLParam[] to be converted to the equivalent document
      parentNode - the parent tag that should be the the parent node of the source array.
      parentURI - the namespace uri that the parentNode belongs to
      includeEmpty - Include empty leaf values as ConfNoExists.toString()
      Throws:
      ConfException - if error occurred
    • toXML

      public Document toXML(ConfXMLParam[] param, String parentNode, String parentURI) throws ConfException
      Transforms the supplied ConfXMLParam[] to a document (Document). Excludes tags with empty leaf values from the resulting document.
      Parameters:
      param - The source ConfXMLParam structure (tag value array) to be converted to a document
      parentNode - 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

      public void serialize(Document doc, OutputStream out) throws ConfException
      Flushes the source document doc to the target out.
      Parameters:
      doc - The source document
      out - The destination stream
      Throws:
      ConfException - if occurred while flushing the document
    • serialize

      public void serialize(Document doc, Writer out) throws ConfException
      Flushes the source document doc to the target out
      Parameters:
      doc - The source document
      out - The destination writer
      Throws:
      ConfException - if occurred while flushing the document