XML:appendChild(name [, text [, attributes [, go]]])
Create a new child element node and attach it as the last child of the current element.
If text is specified, the element will contain a text node that is set to the value of the text string. The text value can be null.
The optional attributes argument can be a table that contains a set of name/value pairs. The table will be used to set the attributes of the new XML element. The attributes value can be null.
The fourth argument is a boolean value. If it is set to true the document position will be set to be the newly created element. Otherwise the document position will not be changed.
doc = xml.new('options')
doc:appendChild('host', '127.0.0.1')
doc:appendChild('port', '5480')
doc:appendChild('database', 'system')
str = tostring(doc)