XmlUnloadFile: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
Line 30: Line 30:
markernode = xmlFindSubNode(xml, "markers", 0)
markernode = xmlFindSubNode(xml, "markers", 0)
xmlNodeSetAttribute(markernode, "color", "0,0,200")
xmlNodeSetAttribute(markernode, "color", "0,0,200")
xmlSaveFile("config.xml", xml)
xmlSaveFile(xml)
xmlUnloadFile(xml)
xmlUnloadFile(xml)
</syntaxhighlight>
</syntaxhighlight>

Revision as of 20:23, 9 March 2008

Unloads an XML document from memory.

Syntax

bool xmlUnloadFile ( xmlnode node )               

Required Arguments

  • node: root of the XML document to unload

Returns

Returns true if the document was unloaded successfully, false otherwise.

Example

Modify a configuration file.

config.xml:

<config>
    <markers color="255,100,0" />
</config>

Lua code:

xml = xmlLoadFile("config.xml")
markernode = xmlFindSubNode(xml, "markers", 0)
xmlNodeSetAttribute(markernode, "color", "0,0,200")
xmlSaveFile(xml)
xmlUnloadFile(xml)

See Also

Template:FunctionArea Functions