XmlCreateFile: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (Needs example)
No edit summary
Line 4: Line 4:


==Syntax==  
==Syntax==  
<section name="Server" class="server" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
xmlnode xmlCreateFile ( string filename, string rootNodeName, [ resource inResource = getThisResource() ] )
xmlnode xmlCreateFile ( string filePath, string rootNodeName )
</syntaxhighlight>  
</syntaxhighlight>  


===Required Arguments===  
===Required Arguments===  
*'''filename:''' the name of the XML file you wish to create.
*'''filePath:''' the path of the file you want to create in the following format: '''":resourceName/path"'''. 'resourceName' is the name of the resource the file will be in, and 'path' is the path from the root directory of the resource to the file.
:For example, if you want to create a file named 'new.xml' in the resource 'ctf', it can be created from another resource this way: ''xmlCreateFile(":ctf/new.xml", "newroot")''.
:If the file is in the current resource, only the file path is necessary, e.g. ''xmlCreateFile("new.xml", "newroot")''.
:Note that if a different resource than default is being accessed, the caller resource needs access to general.ModifyOtherObjects in the [[ACL]].
*'''rootNodeName:''' the name of the root node in the XML document.
*'''rootNodeName:''' the name of the root node in the XML document.
===Optional Arguments===
{{OptionalArg}}
*'''inResource:''' the [[resource]] whose directory will be used as the root for the filename specified. Note that if a different resource than default is being accessed, the caller resource needs access to general.ModifyOtherObjects in the [[ACL]].
</section>
<section name="Client" class="client" show="true">
<syntaxhighlight lang="lua">
xmlnode xmlCreateFile ( string filename, string rootNodeName )
</syntaxhighlight>
===Required Arguments===
*'''filename:''' The [[filepath]] of the XML file you wish to create.  This is a path relative to the clientside root folder of the resource found in your MTA San Andreas installation directory.
*'''rootNodeName:''' The name of the root node in the XML document.
</section>


===Returns===
===Returns===

Revision as of 03:14, 30 July 2009

This function creates a new XML document, which can later be saved to a file by using xmlSaveFile. This function will overwrite the file specified if it already exists.

Syntax

xmlnode xmlCreateFile ( string filePath, string rootNodeName )

Required Arguments

  • filePath: the path of the file you want to create in the following format: ":resourceName/path". 'resourceName' is the name of the resource the file will be in, and 'path' is the path from the root directory of the resource to the file.
For example, if you want to create a file named 'new.xml' in the resource 'ctf', it can be created from another resource this way: xmlCreateFile(":ctf/new.xml", "newroot").
If the file is in the current resource, only the file path is necessary, e.g. xmlCreateFile("new.xml", "newroot").
Note that if a different resource than default is being accessed, the caller resource needs access to general.ModifyOtherObjects in the ACL.
  • rootNodeName: the name of the root node in the XML document.

Returns

Returns the root xmlnode object of the new XML file if successful, or false otherwise.

Example

--TODO

See Also