let doc = { root = { ns = { prefix = "myns", uri = "http://example.com", }, name = "top", attrs = {id = "foo"}, children = [ { ns = "http://example.org/", name = "child1", attrs = { attr1 = "value1", attr2 = "value2"}, children = [ "inner text node", { name = "myns:grandchild", children = [ { text = "Another text node", }, ], }, ], }, ], }, }; out xml doc;