XmlNodeSetValue: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
Line 21: Line 21:


==Example==  
==Example==  
This example does...
In this example is shown what xmlNodeSetValue does and how it works:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--This line does...
local xmlFile=xmlLoadFile("xmlfile.xml") --Open a file already created
blabhalbalhb --abababa
if xmlFile then --If it's indeed opened:
--This line does this...
local node=xmlCreateSubNode(xmlFile,"somesubnode") --Create a new subnode
mooo
local success=xmlNodeSetValue(node,"somevalue") --Set the value of it
if success then --Check if it was successful
xmlSaveFile(xmlFile) --Save the file
end --End what still needs to be ended
end
end
</syntaxhighlight>
 
The xml file wil look like:
<syntaxhighlight lang="xml">
<somenode>
<somesubnode>somevalue</somesubnode>
</somenode>
</syntaxhighlight>
</syntaxhighlight>



Revision as of 20:19, 10 August 2008


This fake function is for use with blah & blah and does blahblahblabhalbhl

Syntax

bool xmlNodeSetValue ( xmlnode xmlnode, string value )            

Required Arguments

  • xmlnode: The node you want to set the value of.
  • value: The value you want the node to have.

Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.

  • none

Returns

Returns true if successful, false otherwise.

Example

In this example is shown what xmlNodeSetValue does and how it works:

local xmlFile=xmlLoadFile("xmlfile.xml") --Open a file already created
if xmlFile then --If it's indeed opened:
	local node=xmlCreateSubNode(xmlFile,"somesubnode") --Create a new subnode
	local success=xmlNodeSetValue(node,"somevalue") --Set the value of it
		if success then --Check if it was successful
			xmlSaveFile(xmlFile) --Save the file
		end --End what still needs to be ended
	end
end

The xml file wil look like:

<somenode>
	<somesubnode>somevalue</somesubnode>
</somenode>

See Also

Template:FunctionArea Functions