-- create an XML document doc = newObject("XML", "") root = doc.createElement("root") doc.appendChild(root) element = doc.createElement("element") root.appendChild(element) textNode = doc.createTextNode("Some text here") element.appendChild(textNode) put doc.toString() -- "Some text here"