Category
XML
All Lua functions and events in the XML category, on the server and the client.
Shared functions 18
xmlCopies a node (with its children and attributes) into a new document at a new path. The copied node becomes the root of the new document, which must be saved withCopy File xmlSaveFile.xmlAdds a new child node with the given name at the end of the parent's children.Create Child xmlCreates a new XML document with a root node of the given name. The document is in memory; it reaches the disk only afterCreate File xmlSaveFile. An existing file is overwritten on save.xmlRemoves a node together with its children. The root node cannot be removed.Destroy Node xmlFinds a child with the given tag name.Find Child indexpicks which one (from 0) among children with that name.xmlLoads an XML file and returns its root node, from which you can read children and attributes. On the server the path is relative to the resource folder (you cannot leave it). On the client it reads the script's own files and thenLoad File <file>files sent by the server; a":other/file.xml"path points to another resource's file. RememberxmlUnloadFilewhen the document is no longer needed.xmlLoads an XML document directly from a string (e.g. received withLoad String fetchRemote), read-only. Returns the root node.xmlReturns the value of a node attribute as text (convert numbers withNode Get Attribute tonumber).xmlReturns all node attributes as a name → value table.Node Get Attributes xmlWithout an index returns a table of all the node's children; with an index (from 0) - one child.Node Get Children xmlReturns the node's tag name (e.g.Node Get Name "spawn"for<spawn/>).xmlReturns the node's parent.Node Get Parent xmlReturns the text inside a node (e.g.Node Get Value "Hello"for<msg>Hello</msg>).xmlSets a node attribute; numbers and other values are converted to text.Node Set Attribute nilorfalseremoves the attribute.xmlChanges the node's tag name.Node Set Name xmlSets the text inside a node (replaces the previous one).Node Set Value xmlSaves the whole document (that the node belongs to) to its file. Does not work for read-only documents or those fromSave File xmlLoadString.xmlFrees a document from memory. All its nodes become invalid. Unsaved changes are lost.Unload File