The XMLDocument Class

IBM Cúram Social Program Management XML data is generated according to the rules of a simple DTD. The XMLDocument class is used to hold the generated XML and wraps the data in the necessary root element. This class is central to all XML operations that you can perform in IBM Cúram Social Program Management. Its interface can be found in the curam.util.xml.impl package within the supplied SDEJ JavaDoc. In the rest of this section, you will learn how to use this interface to create XML documents from your application data.

The use of the XMLDocument class follows the following broad pattern:

  1. Create a new instance of the XMLDocument class.
  2. Open the XML document to create the root element and provide a context for the XML data that you want to create.
  3. Add a struct class (or struct classes) to the open XML document to create the XML data.
  4. Close the XML document to complete the root element.

These steps will be covered in the following sub-sections. First, however, you must be aware of the importance of XML data encoding.