-
Notifications
You must be signed in to change notification settings - Fork 39
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
accessing user_state inside partial to allow streaming output #100
Conversation
@JoeZ99 Thanks for the PR! It looks great to me but could you please run the formatter? |
done! |
@qcam , it's been very hard for me to explain what this PR is for, and about the function names, do you think they are correct and good indicators of function are doing? or should they be improved?? |
I think what you proposed is a very valid use case.
Saxy.Partial.parse(partial, binary) # continue with previous accumulated state.
Saxy.Partial.parse(partial, binary, new_state) # continue previous partial with a new state. Do you think it would work? Partials have very constrained use case and I would be more conservative about introducing new API (so it's harder to use in a wrong way) unless it's unavoidable. |
And great blog post ❤️ ! It's really cool to see the library is used in different creative ways :D. |
Yes, @qcam , you're right. I'll modify the code to do what you suggest and yes, the only reason to "set the state" is to prevent it from growing when parsing large xml files. |
@qcam , how do you like it now?? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM ❤️
Thanks @JoeZ99! |
with the use of
Saxy.Partial.parse_stream()
we can also "streamize" the output (i.e. not having to wait until some provided empty state at the beginning of the parse is fully accumulated), but we should be able to access user state so we can keep it "clean"It's hard to explain, but see this code
that would allow us to "streamize" parsing output, and partially it fixes #95