writeToFile
Puts the content of the data item associated with an XMLStream object into an XML file.
Format 1
void writeToFile ( Xml-Destination )
Format 2
void writeToFile ( Xml-Destination, writeQualifiedTagNames )
Format 3
void writeToFile ( Xml-Destination, encoding )
Format 4
void writeToFile ( Xml-Destination, writeQualifiedTagNames, encoding )
Syntax rules
1. Xml-Destination can be either a Data Item or a Nonnumeric Literal.
2. writeQualifiedTagNames is an alphanumeric data item or literal hosting a boolean value (e.g. "0", "1", "true", "false", "yes", "no", "on" or "off").
3. encoding is a string literal or data item that specifies the character set to be used while writing the XML stream. It accepts the same values as the iscobol.encoding * configuration property.
General rules
1. Xml-Destination refers to a regular disk file.
2. When the write method is invoked, the whole content of the data item associated with the XMLStream object is put into Xml-Destination.
 
NOTE - If the number of occurrences of an XML fields is not known at the time the program is written, specifying the DYNAMIC phrase of the OCCURS clause is recommended.
3. The XMLStream write method will indent the output according to the value of the property iscobol.xmlstream.indent_number. The default is -1 which disables indentation. For example, to indent each level 2 columns set this property as follows:
iscobol.XMLStream.indent_number=2
4. To omit empty elements from the XML output, set the property iscobol.xmlstream.omit_empty_elements (boolean) to true. The default value of this property is false, that means empty elements are generated.
5. If writeQualifiedTagNames is TRUE, namespaces are generated as prefix of the element name, in the form "ns#" where # is a progressive number. If writeQualifiedTagNames is FALSE or omitted, namespaces are generated as attribute of the element, in the form "xmlns=url".
Code example
...
configuration section.
repository
    class xmlStream  as "com.iscobol.rts.XMLStream"
    .
...
working-storage section.
...
77 objXmlStream object reference xmlStream.
...
procedure division.
...
objXmlStream:>writeToFile("Sample.xml")
...