Jump to content

Problem with xml


H!tman

Recommended Posts

in each time i start the resource it creates a new xml + the old xml canno't be deleted until the server closed

:bad-words::bad-words::bad-words::bad-words::bad-words::bad-words::bad-words::bad-words::bad-words:

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

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

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

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