DiSaMe Posted July 10, 2008 Share Posted July 10, 2008 For some reason I can't open clientside XML. This is part of meta.xml: src="enex.map" />="enex.lua" type="client" /> Both files enex.map and enex.lua are successfully downloaded. Part of enex.lua: local enex_file = xmlLoadFile("enex.map") if enex_file then setTimer(outputChatBox,2000,1,"opened file") else setTimer(outputChatBox,2000,1,"failed to open file") end When I join, it writes: "failed to open file". This means that enex.map file isn't loaded! There are no errors in it. It starts with and ends with . What's wrong? Link to comment
Gamesnert Posted July 10, 2008 Share Posted July 10, 2008 ... You're trying to load a .map with a XML function... Might be the problem? Link to comment
DiSaMe Posted July 10, 2008 Author Share Posted July 10, 2008 ... You're trying to load a .map with a XML function... Might be the problem? No. It's in XML format. Only file type is .map. Link to comment
Gamesnert Posted July 10, 2008 Share Posted July 10, 2008 ... You're trying to load a .map with a XML function... Might be the problem? No. It's in XML format. Only file type is .map. But does MTA know that? Answer: no. Every program doing this checks for the extension, before checking the contents. So although it is in XML format, MTA doesn't think so, and thus returns NIL. You may want to wait for an expert to come online to explain more and talk about a possible solution. I only tell my own experiences and things for as far as I know. What MIGHT help: http://development.mtasa.com/index.php?title=FileOpen Not for configuration files... .map is no configuration, right? Link to comment
DiSaMe Posted July 10, 2008 Author Share Posted July 10, 2008 ... You're trying to load a .map with a XML function... Might be the problem? No. It's in XML format. Only file type is .map. But does MTA know that? Answer: no. Every program doing this checks for the extension, before checking the contents. So although it is in XML format, MTA doesn't think so, and thus returns NIL. You may want to wait for an expert to come online to explain more and talk about a possible solution. I only tell my own experiences and things for as far as I know. What MIGHT help: http://development.mtasa.com/index.php?title=FileOpen Not for configuration files... .map is no configuration, right? But does MTA need to know that? Answer: no. xmlLoadFile doesn't check if file extension is XML. It only checks if that file content is XML format. It just needs to find the file independently of extension. Otherwise my server-side random car placer that I put into gamemode I'm working on wouldn't work. Link to comment
Gamesnert Posted July 10, 2008 Share Posted July 10, 2008 Oh? Never knew that, and it did fail in my own experiments... Anyway, might it be because typo's in your mapfile? Link to comment
DiSaMe Posted July 10, 2008 Author Share Posted July 10, 2008 I don't think so. This is the content: > x="2229.63" y="-1721.63" z="12.6529" 2x="2229.13" 2y="-1722.13" 2z="12.6529" ang="497" int="0" />> Or maybe I'm blind a little bit edit: wait, it looks like node attributes starting with numbers are separated into numbers and letters. And not in notepad++. Maybe that's the reason? edit2: oh, yeah, it works! Thanks for making me post the content and see what's wrong Link to comment
churchill Posted July 10, 2008 Share Posted July 10, 2008 no0b mistake! everyone knows an xml element or attribute can't start with a number! don't worry though, I'm sure I'll make an equally silly mistake somewhere down the line Link to comment
Gamesnert Posted July 10, 2008 Share Posted July 10, 2008 no0b mistake! everyone knows an xml element or attribute can't start with a number! Lol, except for that one failed experiment I never tried XML. So I didn't know. ^^ Link to comment
Phat Looser Posted July 13, 2008 Share Posted July 13, 2008 Its a common rule that variables should not begin with numbers.... Link to comment
DiSaMe Posted July 13, 2008 Author Share Posted July 13, 2008 Its a common rule that variables should not begin with numbers.... Yeah, I know this, but I didn't think about that. But when I saw the name separated, I remembered that quickly Link to comment
50p Posted July 13, 2008 Share Posted July 13, 2008 If you don't know if the content of an XML file is correct, use this validator: http://www.w3schools.com/Dom/dom_validate.asp 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