Jump to content

Error while trying to delete XML Node


12p

Recommended Posts

Posted

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 

Posted

you are trying to destroy the file not the node lol.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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

Posted

xmlLoadFile has something wrong thats why it won't work.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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?

Posted

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.

?

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