JuliaIO / LibExpat.jl

Julia interface to the Expat XML parser library
Other
9 stars 32 forks source link

Streaming XML parsing #20

Closed xhochy closed 10 years ago

xhochy commented 10 years ago

I started work on implementing streaming XML parsing. There is still a lot of work to do but I really would appreciate early feedback so that I can develop in the right direction.

Very basic usage which highlights my current architecture choices:

using LibExpat

cbs = XPCallbacks()
cbs.start_element = function (h, name, attrs)
    @printf("Found start tag: %s\n", name)
end

xp_streaming_parse("<t>t</t>", cbs)
xhochy commented 10 years ago

I'm now at the stage where I think this PR is for final review/merge. If it gets accepted I'd work on migrating the ETree parsing process to this streaming backend to avoid further code duplication.

amitmurthy commented 10 years ago

I am OK with merging this. Could you rebase and squash your commits?

@vtjnash comments?

xhochy commented 10 years ago

Squash, rebased and added the missing xml test file

vtjnash commented 10 years ago

seems like a good idea to me. the only thing i would suggest is shortening the method names by removing xp and streaming. In C, these are needed to distinguish the method call, but in Julia, they just makes it harder to have reusable interfaces.

xhochy commented 10 years ago

@vtjnash You mean: renaming xp_streaming_parse to parse?

vtjnash commented 10 years ago

yes, but also parsefile, start, pause, stop, etc

xhochy commented 10 years ago

Removed useless ::Function and xp_streaming_ prefixes

amitmurthy commented 10 years ago

Thanks Jameson. Will merge this in a few hours if there are no more concerns.

amitmurthy commented 10 years ago

And thanks @xhochy for this feature. Do tag and bump the version in METADATA whenever you are ready.