Difference between revisions of "XmlUnloadFile"

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m
m (Fixed example)
Line 1: Line 1:
 
{{Server client function}}
 
{{Server client function}}
{{Needs_Checking|Example outdated. xmlFindSubNode no longer exists.}}
 
 
__NOTOC__
 
__NOTOC__
 
Unloads an XML document from memory.
 
Unloads an XML document from memory.
Line 28: Line 27:
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
 
xml = xmlLoadFile("config.xml")
 
xml = xmlLoadFile("config.xml")
markernode = xmlFindSubNode(xml, "markers", 0)
+
markernode = xmlFindChild(xml, "markers", 0)
 
xmlNodeSetAttribute(markernode, "color", "0,0,200")
 
xmlNodeSetAttribute(markernode, "color", "0,0,200")
 
xmlSaveFile(xml)
 
xmlSaveFile(xml)

Revision as of 19:21, 20 June 2011

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 = xmlFindChild(xml, "markers", 0)
xmlNodeSetAttribute(markernode, "color", "0,0,200")
xmlSaveFile(xml)
xmlUnloadFile(xml)

See Also