H!tman Posted August 23, 2014 Share Posted August 23, 2014 in each time i start the resource it creates a new xml + the old xml canno't be deleted until the server closed this is only server side resource file = xmlLoadFile("Test.xml") if not file then outputChatBox("New xml created",getRootElement(),0,255,255) file = xmlCreateFile("Test.xml","root") child = xmlCreateChild(file,"AAA") else outputChatBox("xml Loaded",getRootElement(),0,255,0) child = xmlFindChild(file,"AAA",0) end xmlNodeSetAttribute(child,"777",1) xmlSaveFile(file) Link to comment
H!tman Posted August 23, 2014 Author Share Posted August 23, 2014 i already did it and it's not working too why don't you try it before posting a comment? Link to comment
Et-win Posted August 23, 2014 Share Posted August 23, 2014 i already did it and it's not working toowhy don't you try it before posting a comment? Because we aren't all of those people who ask for help their slaves? Post your new script with xmlUnloadFile. Otherwise: Is this your same problem: http://bugs.mtasa.com/view.php?id=8466 ? Link to comment
H!tman Posted August 23, 2014 Author Share Posted August 23, 2014 no it's not and this is the script with xmlUnloadFile file = xmlLoadFile("Test.xml") if not file then outputChatBox("New xml created",getRootElement(),0,255,255) file = xmlCreateFile("Test.xml","root") child = xmlCreateChild(file,"AAA") else outputChatBox("xml Loaded",getRootElement(),0,255,0) child = xmlFindChild(file,"AAA",0) end xmlNodeSetAttribute(child,"777",1) xmlSaveFile(file) xmlUnloadFile(file) Link to comment
H!tman Posted August 23, 2014 Author Share Posted August 23, 2014 restart the resource and see if the message "New xml created" appears again and again Link to comment
Et-win Posted August 23, 2014 Share Posted August 23, 2014 restart the resource and see if the message "New xml created" appears again and again I did Link to comment
H!tman Posted August 23, 2014 Author Share Posted August 23, 2014 i get this message "New xml created" in each time i restart the resource did mta made changes these days?(update) Edit: without this function ( xmlNodeSetAttribute ) the resource works fine Link to comment
Et-win Posted August 23, 2014 Share Posted August 23, 2014 What if you replace '777' with just letters? Link to comment
H!tman Posted August 23, 2014 Author Share Posted August 23, 2014 yeah thanks it works fine now when using numbers only it doesn't work but letters only or letters and numbers it works but why i can't use numbers? Link to comment
Et-win Posted August 23, 2014 Share Posted August 23, 2014 In Notepad++ the numbers are blue, which I already thought it was strange. Maybe it's reserved for XML, but I'm totally not sure. Link to comment
Mr_Moose Posted August 24, 2014 Share Posted August 24, 2014 Naming an xml child to a number would give an output like this: <root> <child></child> <!-- Correct syntax --> <777></777> <!-- Incorrect syntax --> </root> Which gives syntax errors, this applies to all markup languages like xml, html, xaml etc. And generally for all programming languages you can't start a variable name with a number, it must be "a-z" or "_" as first char, after that you can use numbers. 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