Jump to content

Error while trying to delete XML Node


12p

Recommended Posts

Why can't I delete this XML node? It should work but it doesn't, everything I try shows me my debug error: "error erasing map".

function eraseMap () 
    stopResource(getResourceFromName("minecraftmap")) 
    local mapFile = xmlLoadFile (":minecraftmap/map.map") 
    if xmlDestroyNode (mapFile) then 
     outputDebugString ("Minecraft: Map erased.") 
    else 
     outputDebugString ("Minecraft: Error erasing map.") 
    end 
end 

Link to comment

But xmlLoadFile returns a XML Node, it should work. Whatever, I used

function eraseMap () 
    stopResource(getResourceFromName("minecraftmap")) 
    local mapFile = xmlLoadFile (":minecraftmap/map.map") 
    local node = xmlFindChild (mapFile,"map",1) 
    if xmlDestroyNode (node) then 
     outputDebugString ("Minecraft: Map erased.") 
    else 
     outputDebugString ("Minecraft: Error erasing map.") 
    end 
end 

and still don't work. But it tells me this error: "ERROR: bad argument "xmlDestroyNode".

ps: the filepath is OK, isn't that

Link to comment
function eraseMap () 
    stopResource(getResourceFromName("minecraftmap")) 
    if xmlLoadFile (":minecraftmap/map.map") then 
     outputDebugString ("Minecraft: Map loaded for erasing.") 
    end 
    --[[local node = xmlFindChild (mapFile,"map",1) 
    if xmlDestroyNode (node) then 
     outputDebugString ("Minecraft: Map erased.") 
    else 
     outputDebugString ("Minecraft: Error erasing map.") 
    end ]]-- 
end 

sinttuloph.png

It isn't the problem. If the problem is "xmlLoadFile" then my debug message shouldn't appear.

PS: Maybe MTA inside error?

Link to comment

it makes perfect sense:

xmlLoadFile returns root node. if you delete the root node, how can you operate the loaded XML file?

just delete the file and that's it. maybe. :D

EDIT: on the other hand, maybe you are trying to delete the file.

anyway, i'd just delete all children of the root node.

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