Skip to main content

Name

xml.parsexml — Create an XML document object

Synopsis

require('xml');

xml.parsexml(strxml, keep_blanks);

strxml: string
keep_blanks: numeric (optional)

Description

This function parses an XML string and returns an XML document object. The second argument, keep_blanks is an optional integer value. When not set or set to 0, ignorable white spaces will be ignored, otherwise, text nodes containing those blanks will be generated in the Document Object Model (DOM) output.

local doc = xml.parsexml([[<doc></doc>]]);
local node = doc:root();
local child = node:addchild("item")

See Also

Was this page helpful?