Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example of streaming #91

Open
johannspies opened this issue Jul 11, 2018 · 1 comment
Open

Example of streaming #91

johannspies opened this issue Jul 11, 2018 · 1 comment

Comments

@johannspies
Copy link

Can you please add an example on how to use LibExpat.jl when streaming a large file to the documentation or the Jupyter notebook? For my lack of experience the template in the README is not enough to help me.

@MKoesters
Copy link

MKoesters commented Jul 22, 2018

Hi,
I would also be happy to have a more comprehensive documentation for the streaming API.

I managed to get the following running, but what I really want to do is to iterate the XML file and get back the return value of the callback to interrogate with this.

using LibExpat
using Compat

type Container
    name::String
    id::Int64
end

tag_name = "test"
L = []
cb = XPCallbacks()
cb.start_element = function (h, name, attrs)
    if name == tag_name
        id = parse(Int64, split(attrs["id"], "=")[2])
        c = Container(name, id)
        push!(L, c)
        return c
    end
end

parsefile(filename, cb)

Before I try implement an iterator myself, is there any way to do this using your package?
Sry for hijacking your issue Johann, but I thought my progress so far might help you a little :)
If not, just tell me and I'll move it to another Issue

Manuel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants