xml.decode(str)function

Parses a string containing XML content and returns the root Node object representing the XML structure.

Parameters

str

A string containing valid XML data to be parsed.

Return value

Returns a Node object if parsing succeeds, or nil if the XML is invalid.

Example

--! luart-extensions import xml -- Parse XML string local root = xml.decode("<root><greeting>Hello</greeting></root>") -- Access child node print(root[1].name) -- greeting