Jump to content

xmlCreateFile and xmlSaveFile


piras

Recommended Posts

Hello,

I am trying to save some stuff with these functions.

They are not returning errors but the file is not getting saved.

I can call xmlNodeGetAttributes on the node Im trying to save and it works as expected.

function saveRamps()
outputDebugString("saveRamps()", 0)
local xml = xmlCreateFile("savedRamps.xml", "ramps")
local rampXml
if not xml then outputConsole("Couldnt CREATE xml file.", 0) end --<<=== This seems to work OK.
 
for rampName,rampTabElement in pairs(win.ramps) do
if type(rampTabElement) == "table" and rampTabElement.type == "tab" then
		rampXml = xmlCreateChild(xml, rampName)
xmlNodeSetAttribute(rampXml, "modelId", rampTabElement.modelIdEdit:getValueAsString())
xmlNodeSetAttribute(rampXml, "topAngle", rampTabElement.topAngleEdit:getValueAsString())
xmlNodeSetAttribute(rampXml, "radius", rampTabElement.radiusEdit:getValueAsString())
xmlNodeSetAttribute(rampXml, "resolution", rampTabElement.resolutionEdit:getValueAsString())
xmlNodeSetAttribute(rampXml, "length", rampTabElement.lengthEdit:getValueAsString())
 
		tableOut(xmlNodeGetAttributes(rampXml)) --<=== This works OK, everything looks fine.
end
end
 
if not xmlSaveFile(xml) then outputConsole("Couldnt SAVE xml file.", 0) end --<=== This seems to work OK.
end

I can load an xml file with xmlLoadFile.

Have I done something wrong like not called a function before calling xmlSaveFile, or something ...

Link to comment

By the way this was on a client side script.

I managed to get around it, by sending all the data to the server with triggerServerEvent() and use the xml functions from the server side and they work from the server side.

Link to comment

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...