xmlLoadFile | Multi Theft Auto: Wiki Skip to content

xmlLoadFile

Client-side
Server-side
Shared

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.

OOP Syntax Help! I don't understand this!

  • Method: XML.load(...)

Syntax

xmlnode|false xmlLoadFile ( string filePath, [ boolean readOnly = false ] )
Required Arguments
  • filePath: The Filepath of the file 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.
Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use.

  • readOnly (default: false): By default, the XML file is opened with reading and writing access. You can specify true for this parameter if you only need reading access.

Returns

  • xmlnode|false: xmlnode

Returns the root xmlnode object of an xml file if successful, or false otherwise.

Code Examples

shared

This example loads an XML file called settings.xml that is in a resource called ctv.

local node = xmlLoadFile ( ":ctv/settings.xml" )