XML stream parser

70 views
Skip to first unread message

szczepan

unread,
Jun 7, 2016, 7:29:15 AM6/7/16
to Haxe
Hey guys,

any of you know of a Haxe XML library parsing it from a stream? I need to process large XML files and I find default Haxe DOM XML implementation rather slow and very memory hungry and would rather use something in pure Haxe, before writing something on my own (then it'll be targeting only PHP).

Thanks.

JLM

unread,
Jun 7, 2016, 8:44:28 AM6/7/16
to Haxe
Currently Json has much better support are you not able to use Json instead?
http://haxe.org/manual/std-Json-parsing.html

szczepan

unread,
Jun 7, 2016, 8:49:11 AM6/7/16
to Haxe
I'm consuming externally provided XML file which is to be loaded daily into local DB. As it's a shared (PHP) hosting resources are limited (time and memory).

Jason O'Neil

unread,
Jun 8, 2016, 6:07:00 AM6/8/16
to haxe...@googlegroups.com
If the only target you care about is PHP, perhaps you could use a native PHP class that supports streaming XML.  I haven't looked in detail but perhaps this one will do the trick:

http://php.net/manual/en/class.xmlreader.php

You can't use this from Haxe directly, you will need to create an extern class to interact with the native PHP code.  Luckily that's fairly easy to do for a simple class like this, you can find a short explanation here:

http://old.haxe.org/doc/php/extern_libraries

Hope that helps,
Jason

--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/d/optout.

Jacek Szymański

unread,
Jun 8, 2016, 6:12:02 AM6/8/16
to Haxe
I have ported kxml2 from java to haxe, it's called girsu and it's on haxelib. It's slow, but usable (I'm using it at least) and reads from a stream.

http://lib.haxe.org/p/girsu
https://bitbucket.org/parensoft/girsu

--js


On Tuesday, June 7, 2016 at 1:29:15 PM UTC+2, szczepan wrote:
Reply all
Reply to author
Forward
0 new messages