doc:root

March 26, 2020

Name

doc:root — Return the root node of an XML document

Synopsis

require('xml');

doc:root();

Description

Where doc is an XML object created using xml.parsexml, return the root node.

local doc = xml.parsexml([[<doc></doc>]]);
local node = doc:root();
local child = node:addchild("item");
child:contents("I am a child node.");
print(node:tostring());

See Also

xml.parsexml