- Documentation
- Shared functions
- xmlCreateFile
Function
xmlCreateFile
Creates a new XML document with a root node of the given name. The document is in memory; it reaches the disk only after xmlSaveFile. An existing file is overwritten on save.
Syntax
xmlnode xmlCreateFile(string filePath, string rootNodeName)Arguments
filePathstring- File path in the resource folder.
rootNodeNamestring- Root node name (letters, digits,
_,-,.,:).
Returns
The root node, or false.
Example
local root = xmlCreateFile("bans.xml", "bans")
local ban = xmlCreateChild(root, "ban")
xmlNodeSetAttribute(ban, "serial", "ABC123")
xmlNodeSetAttribute(ban, "reason", "Cheaty")
xmlSaveFile(root)
xmlUnloadFile(root)