12p Posted December 22, 2010 Share Posted December 22, 2010 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
Castillo Posted December 22, 2010 Share Posted December 22, 2010 you are trying to destroy the file not the node lol. Link to comment
12p Posted December 22, 2010 Author Share Posted December 22, 2010 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
Castillo Posted December 22, 2010 Share Posted December 22, 2010 xmlLoadFile has something wrong thats why it won't work. Link to comment
12p Posted December 22, 2010 Author Share Posted December 22, 2010 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 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
Aibo Posted December 22, 2010 Share Posted December 22, 2010 maybe you just can't destroy root node, that's all. try deleting all children. Link to comment
12p Posted December 22, 2010 Author Share Posted December 22, 2010 Isn't supposed I can? Link to comment
Aibo Posted December 22, 2010 Share Posted December 22, 2010 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. 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
12p Posted December 22, 2010 Author Share Posted December 22, 2010 I just deleted the file by removeResourceFile. Thanks Aiboforcen. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now