Jump to content

xmlLoadFile returns false while syntax is correct?


Deltanic

Recommended Posts

Hmm, EVERY script works, they all use the same technique. But this one doesn't work, and I don't know why.

xmlLoadFile( "zones.xml" )

That will return false. But IT IS placed in the meta:

<config src="playerutils\zones.xml" type="client" />

While this one is returning true, and works:

xmlLoadFile( "vehicles.xml" )

<config src="playerutils\vehicles.xml" type="client" />

Both XML files are using the same syntax:

<root>
   <group type="Fruit">
       <food name="Strawberry" color="Red" />
       <food name="Banana" color="Yellow" />
   </group>
</root>

So, what the hack is the problem?

Link to comment

<config src="playerutils\zones.xml" type="client" />
-----
<config src="playerutils/zones.xml" type="client" />

I do not recommend you using "\" in xml files. "/" works on Windows as good as on *nix servers. Also, you tell server/client there is a file in "playerutils/" folder but when you load it, you just load from the root folder.

Link to comment

Well, if I need to call the XML from the playerutils folder, how is it then ever possible that vehicles.xml does work? That's kinda strange to me.

And I tried placing the XML files in the root folder, but even then the zones.xml won't work, while vehicles.xml and all others does work :?

Link to comment

It's not possible to load a file from a folder which you didn't specify in xmlLoadFile. Imagine having 2 files with the same name in the root folder and a subfolder. It's not logical that it'd load a file from folder with specifying only "filename.xml" as the file to load. Show your zones.xml file, it must be faulty if you can't load it.

Link to comment

impossible? :P I can screen it if you want :P But here is the zones.xml:

<root>
<group type="Airports">
	<tele name="Los Santos Airport" posX="1647" posY="-2237" posZ="155" />
	<tele name="Las Venturas Airport" posX="1266" posY="1324" posZ="12" />
	<tele name="San Fierro Airport" posX="-1362" posY="-247" posZ="14" />
</group>
<group type="Stuntified streets and cities">
	<tele name="Grove Street" posX="2495" posY="1690" posZ="14" />
	<tele name="San Fierro Building Jump" posX="-2210" posY="1252" posZ="87" />
</group>
</root>

Link to comment

Thnx, getResourceConfig works. But wtf. I'm on a different PC now, I tried xmlLoadFile ("vehicles.xml") and that still works. And zones.xml still doesn't. BUT, xmlLoadFile ("playerutils/zones.xml") DOES work here, so maybe this all was a MTA or Win7 bug? It's strange, but it works.

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