Jump to content

Recommended Posts

function createFileHandler()
	local RootNode = xmlCreateFile("new.xml"," newroot")
	test_1 = xmlFindChild ( RootNode, "Test_1", 0 )
	test_2 = xmlFindChild ( RootNode, "Test_2", 0 )

	if test_1 == false then	test_1 = xmlCreateChild ( RootNode, "Test_1", 0 ) end
	if test_2 == false then test_2 = xmlCreateChild ( RootNode, "Test_2", 0 ) end
	xmlNodeSetValue ( test_1, 10 )
	xmlNodeSetValue ( test_2, 1 )

	xmlSaveFile(RootNode)
	xmlUnloadFile(RootNode)
end
addCommandHandler("createfile", createFileHandler)

function createFileHandler(commandName, param1, param2)
	local RootNode = xmlCreateFile("new.xml"," newroot")
	test = xmlFindChild ( RootNode, param1, 0 )

	if test == false then test = xmlCreateChild ( RootNode, param1, 0 ) end
	xmlNodeSetValue ( test, param2 )

	xmlSaveFile(RootNode)
	xmlUnloadFile(RootNode)
end
addCommandHandler("val", createFileHandler)

 

Edited by Mr.DeViLsS
Link to comment
  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...