open(String generatedBy, String generatedDate, String version, String comment); openForList(String generatedBy, String generatedDate, String version, String comment);
Once you have instantiated an XMLDocument object, you need to open it in one of two ways. If you want to write the details of a single struct class to the XML document, you must open the document with the open() method. If you want to write the details of several different struct classes of the same type to the document, you must open the document with the openForList() method. This latter method allows you to create a document that contains a list of struct classes where each one is added in turn. All the struct classes must be of the same type. The former method allows you to add only a single struct class to the document before closing it. This single struct class can, however, contain fields that are lists of struct classes.
Both of the open methods take several parameters that can be used to set meta-data for the document. You can include the name of the entity that generated the document, the date and time on which it was generated, the version of the document, and any other comments you wish to associate with the document. Each parameter is a string and you can use any length of data formatted in any way you wish. You must, however, respect the requirement of XML that certain characters be converted to character entities. If your strings contain any of the following characters: "'", "", "<", ">", or "&", you must convert them to their character entity values. This can be done by calling the XMLDocument. escape() method. The method takes a string parameter and returns a new string with the character entity conversions done for you.
Once opened, you can begin adding struct classes to your XML document.