XmlLoadFile: Difference between revisions
Jump to navigation
Jump to search
(→Syntax) |
No edit summary |
||
Line 19: | Line 19: | ||
<section name="Client" class="client" show="true"> | <section name="Client" class="client" show="true"> | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
xmlnode xmlLoadFile ( string filePath | xmlnode xmlLoadFile ( string filePath ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 26: | Line 26: | ||
:For example, if there is a file named 'settings.xml' in the resource 'ctf', it can be accessed from another resource this way: ''xmlLoadFile(":ctf/settings.xml")''. | :For example, if there is a file named 'settings.xml' in the resource 'ctf', it can be accessed from another resource this way: ''xmlLoadFile(":ctf/settings.xml")''. | ||
:If the file is in the current resource, only the file path is necessary, e.g. ''xmlLoadFile("settings.xml")''. | :If the file is in the current resource, only the file path is necessary, e.g. ''xmlLoadFile("settings.xml")''. | ||
</section> | </section> | ||
Revision as of 23:38, 16 July 2011
This function provides an alternative way to load XML files to getResourceConfig. This function loads an XML file and returns the node by specifying a specific file path, while getResourceConfig allows for loading an XML file from a resource.
Syntax
Click to collapse [-]
Serverxmlnode xmlLoadFile ( string filePath )
Required Arguments
- filePath: The filepath of the file in the following format: ":resourceName/path". 'resourceName' is the name of the resource the file is in, and 'path' is the path from the root directory of the resource to the file.
- For example, if there is a file named 'settings.xml' in the resource 'ctf', it can be accessed from another resource this way: xmlLoadFile(":ctf/settings.xml").
- If the file is in the current resource, only the file path is necessary, e.g. xmlLoadFile("settings.xml").
Click to collapse [-]
Clientxmlnode xmlLoadFile ( string filePath )
Required Arguments
- filePath: The filepath of the file in the following format: ":resourceName/path". 'resourceName' is the name of the resource the file is in, and 'path' is the path from the root directory of the resource to the file.
- For example, if there is a file named 'settings.xml' in the resource 'ctf', it can be accessed from another resource this way: xmlLoadFile(":ctf/settings.xml").
- If the file is in the current resource, only the file path is necessary, e.g. xmlLoadFile("settings.xml").
Returns
Returns the root xmlnode object of an xml file if successful, or false otherwise.
Example
This example loads an XML file called settings.xml that is in a resource called ctv.
node = xmlLoadFile ( ":ctv/settings.xml" )
See Also
- xmlCopyFile
- xmlCreateChild
- xmlCreateFile
- xmlDestroyNode
- xmlFindChild
- xmlLoadFile
- xmlLoadString
- xmlNodeGetAttribute
- xmlNodeGetAttributes
- xmlNodeGetChildren
- xmlNodeGetName
- xmlNodeGetParent
- xmlNodeGetValue
- xmlNodeSetAttribute
- xmlNodeSetName
- xmlNodeSetValue
- xmlSaveFile
- xmlUnloadFile