XmlNodeSetName: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(New page: __NOTOC__ {{Server client function}} Sets the tag name of the specified XML node. ==Syntax== <syntaxhighlight lang="lua"> bool xmlNodeSetName ( xmlnode node, string name ) </syntaxhighlight> ===Required Arguments==...)
 
(Do not forget xmlUnloadFile.)
 
(6 intermediate revisions by 5 users not shown)
Line 7: Line 7:
bool xmlNodeSetName ( xmlnode node, string name )
bool xmlNodeSetName ( xmlnode node, string name )
</syntaxhighlight>
</syntaxhighlight>
{{OOP||[[xmlnode]]:setName|name|xmlNodeGetName}}


===Required Arguments===
===Required Arguments===
Line 14: Line 15:
===Returns===
===Returns===
Returns ''true'' if successful, ''false'' otherwise.
Returns ''true'' if successful, ''false'' otherwise.
==Example==
<syntaxhighlight lang="lua">
local xml = xmlCreateFile("fileName.xml","Test")
local xmlNode = xmlCreateChild(xml,"Test1")
local xmlNodeName = xmlNodeGetName(xmlNode)
xmlUnloadFile(xml)
if xmlNodeName == "Test1" then
  xmlNodeSetName(xmlNode, "Test2")
end
</syntaxhighlight>


==See Also==
==See Also==
{{XML functions}}
{{XML functions}}
[[ru:xmlNodeSetName]]

Latest revision as of 20:51, 12 May 2019

Sets the tag name of the specified XML node.

Syntax

bool xmlNodeSetName ( xmlnode node, string name )

OOP Syntax Help! I don't understand this!

Method: xmlnode:setName(...)
Variable: .name
Counterpart: xmlNodeGetName


Required Arguments

  • node: the node to change the tag name of.
  • name: the new tag name to set.

Returns

Returns true if successful, false otherwise.

Example

local xml = xmlCreateFile("fileName.xml","Test")
local xmlNode = xmlCreateChild(xml,"Test1")
local xmlNodeName = xmlNodeGetName(xmlNode)
xmlUnloadFile(xml)
if xmlNodeName == "Test1" then
   xmlNodeSetName(xmlNode, "Test2")
end

See Also