XmlNodeSetName: Difference between revisions
Jump to navigation
Jump to search
(add oop syntax) |
(Do not forget xmlUnloadFile.) |
||
| (3 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server client function}} | {{Server client function}} | ||
Sets the tag name of the specified XML node. | Sets the tag name of the specified XML node. | ||
| Line 19: | Line 18: | ||
==Example== | ==Example== | ||
<syntaxhighlight lang="lua"> | <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> | </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