Jump to content

XML Loading


Chronic

Recommended Posts

Posted

Hey guys, I'm really not getting this I'm wondering if anyone can explain this to me.

Outputs true, so the file exists:

outputChatBox ( tostring ( fileExists ( "files/settings.xml" ) ) ) 

However, this outputs false, and I don't understand why.

local xml = xmlLoadFile ( "files/settings.xml" ) 
outputChatBox ( tostring ( xml ) ) 

The xml file looks like this:

<settings rAccount="true" username="dkjslkd" password="ddsldklsd"></settings> 

Posted

In first place, your XML should look like this, because in every XML there NEEDS to be a parent node.

<settings> 
<setting rAccount="true" username="dkjslkd" password="ddsldklsd" /> 
</settings> 

In second place, I don't know what you're trying to achieve with that Lua code, but it will only output a string of the raw data value of the element that your XML node is.

Easier way around: you'll get a load of text that will make no sense.

Use the following functions for a profitable code:

xmlNodeGetChildren 
xmlNodeGetAttribute 

Posted

I don't think it matters what I'm trying to achieve, I was just testing if the XML loaded properly, which it didn't. Your XML file didn't work either, it still won't load.

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