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

"Push" based XmlReader #49

Closed
dnfield opened this issue Aug 9, 2018 · 4 comments
Closed

"Push" based XmlReader #49

dnfield opened this issue Aug 9, 2018 · 4 comments

Comments

@dnfield
Copy link
Contributor

dnfield commented Aug 9, 2018

I really appreciate the work you've done on this library, and I'm happy to see the SAX based interface.

I'm interested in a .NET style XmlReader interface, where, instead of callbacks on events, you tell the reader when you're ready to continue. I have some ideas around implementing this based on your SAX interface. Would you be interested in including such a thing here?

@dnfield
Copy link
Contributor Author

dnfield commented Aug 9, 2018

Here's a rough not very well tested implementation - I'd insert this into XmlReader.dart:

https://gist.github.com/dnfield/e176f1d604b21a67265896390c4ca6ee

@renggli
Copy link
Owner

renggli commented Aug 9, 2018

Looks interesting, but what about using generators? I think that would better fit the Dart language and directly map the callback code to the existing XmlReader implementation. I clearly haven't fully thought this through ...

@dnfield
Copy link
Contributor Author

dnfield commented Aug 9, 2018

What would the generators produce though? An Iterable of what?

Basically, the big advantage I'm looking for is the ability to more easily manage state (read until you hit this element, then pass the reader off to another class/function that will read through a subtree, then resume control, etc.). That's harder to manage in a SAX style scenario.

@dnfield
Copy link
Contributor Author

dnfield commented Aug 9, 2018

I'll do a PR with a bit more implemented too

@dnfield dnfield closed this as completed Nov 30, 2018
@renggli renggli reopened this Jan 7, 2019
@renggli renggli closed this as completed Jan 7, 2019
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