load xml from html5

191 views
Skip to first unread message

lchellini

unread,
Dec 6, 2012, 3:05:22 AM12/6/12
to haxe...@googlegroups.com
I'm trying to load an external xml file in html5 with xml.fast but it doesn't.
I use this code

var xmlData:Xml = Xml.parse( Assets.getText ("assets/data.xml") );

xml parsing works using xml text inside code.

How can I do?

Regards
Lorenzo

Baluta Cristian

unread,
Dec 6, 2012, 4:02:21 AM12/6/12
to haxe...@googlegroups.com
I have the same problem with the mention that, is not working anymore. I have the latest nme from svn and in this version they used the assets structure as it is, no renames. This is a good thing as i didn't saw the point in renaming, but now the assets are not working anymore for me. 
Did you traced the result? Did you added the xml to your assets in nmml? Assets can't load external assets.


lchellini

unread,
Dec 6, 2012, 11:59:21 PM12/6/12
to haxe...@googlegroups.com
I added the xml to assets, but html page doesn't load. I tried using URLLoader with no success

Axel Huizinga

unread,
Dec 7, 2012, 1:34:37 AM12/7/12
to haxe...@googlegroups.com
Am 07.12.2012 05:59, schrieb lchellini:
I added the xml to assets, but html page doesn't load. I tried using URLLoader with no success
just tried with nme.net.URLLoader - works as expected.
maybe you can post some code.

cordially,
axel

lchellini

unread,
Dec 7, 2012, 3:24:07 AM12/7/12
to haxe...@googlegroups.com

Here is my code:


import nme.net.URLLoader;

import nme.net.URLRequest;


var _xmlLoader:URLLoader = new URLLoader();

_xmlLoader.addEventListener( Event.COMPLETE, _onXMLLoaded );

_xmlLoader.load(new URLRequest("data.xml"));


I'm trying locally.

Never pass to _onXMLLoaded function.


Thanks

Lorenzo

Florian Hofmann

unread,
Dec 7, 2012, 3:29:47 AM12/7/12
to haxe...@googlegroups.com
are you testing local or on a server? local file loading doesn't work. the easiest solution is to use neko's simple webserve:
commandline -->
nekotools server -d /path/to/your/project/root

and then in the browser:

lchellini

unread,
Dec 7, 2012, 3:48:39 AM12/7/12
to haxe...@googlegroups.com
I'm testing local; neko's webserver can be a solution for me, but not for my client.
Any solution to load txt or xml file locally from html?

Baluta Cristian

unread,
Dec 7, 2012, 3:57:52 AM12/7/12
to haxe...@googlegroups.com
Would you like that to be possible? 
Htmls are meant to run on a server, if you want them locally something is wrong in the design.

Axel Huizinga

unread,
Dec 7, 2012, 4:24:24 AM12/7/12
to haxe...@googlegroups.com
Am 07.12.2012 09:48, schrieb lchellini:
I'm testing local; neko's webserver can be a solution for me, but not for my client.
Any solution to load txt or xml file locally from html?
maybe a local apache webserver would be an option?

lchellini

unread,
Dec 7, 2012, 5:07:01 AM12/7/12
to haxe...@googlegroups.com
No ways to load xml file or connect to db locally from html?
Reply all
Reply to author
Forward
0 new messages