Node:clone()method

Creates a deep copy of the current node, including its attributes and all descendant nodes.

Return value

Returns a new Node identical to the original.

Example

--! luart-extensions import xml local book = xml.Node("book") book:add("title", "Lua") local copy = book:clone() copy.name = "bookCopy" print(copy[1].name) -- title