- Documentation
- Shared functions
- xmlSaveFile
Function
xmlSaveFile
Saves the whole document (that the node belongs to) to its file. Does not work for read-only documents or those from xmlLoadString.
Syntax
bool xmlSaveFile(xmlnode rootNode)Arguments
rootNodexmlnode- Any node of the document (usually the root).
Returns
true when saved.
Example
local root = xmlLoadFile("settings.xml") or xmlCreateFile("settings.xml", "settings")
xmlNodeSetAttribute(root, "lastStart", os.date("%Y-%m-%d %H:%M"))
xmlSaveFile(root)
xmlUnloadFile(root)
See also
xmlCreateFileCreates a new XML document with a root node of the given name. The document is in memory; it reaches the disk only afterxmlSaveFile. An existing file is overwritten on save.xmlLoadFileLoads 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 then<file>files sent by the server; a":other/file.xml"path points to another resource's file. RememberxmlUnloadFilewhen the document is no longer needed.