Difference between revisions of "XmlUnloadFile"
From Multi Theft Auto: Wiki
m (→Added 'See Also' related functions - added lua-tag to explaining code) |
|||
Line 1: | Line 1: | ||
[[Category:Incomplete]] | [[Category:Incomplete]] | ||
− | __NOTOC__ | + | __NOTOC__ |
− | + | {{Server client function}} | |
+ | Unloads an XML document from memory. | ||
==Syntax== | ==Syntax== | ||
Line 10: | Line 11: | ||
===Required Arguments=== | ===Required Arguments=== | ||
− | *''' | + | *'''xmlnode:''' root of the XML document to unload |
− | |||
− | |||
− | |||
− | |||
− | |||
===Returns=== | ===Returns=== | ||
− | Returns ''true'' if | + | Returns ''true'' if the document was unloaded successfully, ''false'' otherwise. |
==Example== | ==Example== | ||
− | + | Modify a configuration file. | |
+ | |||
+ | config.xml: | ||
+ | <syntaxhighlight lang="xml"> | ||
+ | <config> | ||
+ | <markers color="255,100,0" /> | ||
+ | </config> | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | Lua code: | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
− | + | xml = xmlLoadFile("config.xml") | |
− | + | markernode = xmlFindSubNode(xml, "markers", 0) | |
− | + | xmlNodeSetAttribute(markernode, "color", "0,0,200") | |
− | + | xmlSaveFile("config.xml", xml) | |
+ | xmlUnloadFile(xml) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 16:47, 15 August 2007
Unloads an XML document from memory.
Syntax
bool xmlUnloadFile ( xmlnode xmlnode )
Required Arguments
- xmlnode: 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("config.xml", xml) xmlUnloadFile(xml)
See Also
Template:FunctionArea Functions
- xmlLoadString
- xmlNodeGetAttribute
- xmlNodeGetAttributes
- xmlNodeGetChildren
- xmlNodeGetName
- xmlNodeGetParent
- xmlNodeGetValue
- xmlNodeSetAttribute
- xmlNodeSetName
- xmlNodeSetValue
- xmlSaveFile
- xmlUnloadFile