XMLw Class
Properties Methods Events Configuration Settings Errors
The XMLw component provides an easy way to generate well-formed XML documents.
Syntax
ipworks.xmlw()
Remarks
The XMLw class creates XML documents while providing you control over every aspect of the document.
To use the class first decide whether or not to write to file, a stream, or to OutputData. To write to file set OutputFile. To write to a stream call SetOutputStream. If neither OutputFile nor SetOutputStream are used the document will be created in memory and will be available from OutputData.
To begin writing the XML document first call WriteXMLDeclaration. While this is not required is it suggested so that your XML document contains a traditional XML declaration at the beginning of the document.
Next begin adding elements to your document. Calling StartElement will open an element with the specified name. To create a nested structure continue calling StartElement to open more child elements. To write a value within an element call WriteString. To close the element that was last opened call EndElement. Each time EndElement is called the element at the current level is closed. Alternatively, calling WriteElement will write the element specified with the value specified and will also close the element.
To write an attribute of the current element, after calling StartElement call WriteAttribute. Call WriteAttribute multiple times to add multiple attributes.
Writing comments or CDATA can be done at any time with the WriteComment and WriteCData methods.
To close your XML document call Close. You can call Close from any location and it will close any remaining open elements automatically.
Property List
The following is the full list of the properties of the class with short descriptions. Click on the links for further details.
EOL | The characters to use for separating lines. |
Indent | The characters to use for each indentation level. |
OutputData | The buffered XML output data. |
OutputFile | The path to a local file where the output will be written. If the file exists, it is overwritten. |
Method List
The following is the full list of the methods of the class with short descriptions. Click on the links for further details.
Close | Closes the component writing stream. |
Config | Sets or retrieves a configuration setting . |
EndElement | Writes the closing tag of an open XML element. |
Reset | Reset the component. |
StartElement | Writes the opening tag of an XML element. |
WriteAttribute | Writes an XML attribute. |
WriteCData | Writes an XML CDATA block. |
WriteComment | Writes an XML comment block. |
WriteElement | Writes a simple XML element with a value. |
WriteRaw | Writes a raw XML fragment. |
WriteString | Writes text inside an XML element. |
WriteXMLDeclaration | Writes an XML declaration at the top of the document. |
Event List
The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.
Error | Information about errors during data delivery. |
Configuration Settings
The following is a list of configuration settings for the class with short descriptions. Click on the links for further details.
Charset | Specifies the charset used when encoding data. |
QuoteChar | Quote character to use for attribute values. |
CodePage | The system code page used for Unicode to Multibyte translations. |