Add functions to ignore subtrees & result-streaming (yield) parsers#40
Add functions to ignore subtrees & result-streaming (yield) parsers#40ulikoehler wants to merge 28 commits intosnoyberg:masterfrom
Conversation
xml-conduit/Text/XML/Stream/Parse.hs
Outdated
|
It looks good to me, I didn't see any issues. Would you be able to add a few test cases to the test suite to cover the new functions? |
|
Sure, I'll add some unit tests |
|
So far I added tests for |
|
Just pinging the issue. |
|
Still working on it, albeit slowly. I'm currently trying to add unit tests that test if certain parsers fail for certain XMLs. |
|
Any chance of this being merged sometime soon? |
|
Currently not, as the branch no longer merges. If @ulikoehler or someone else wants to clean this up and get it ready for merge, I have no objection to reviewing again. |
|
I still have this on my radar and intend to fix it, however I'm currently occupied with my Bachelor's thesis (probably until May). If someone else can spare some time for writing more unit tests or other fixes, I'll be happy to assist. |
|
I have a branch containing the commits here that merges cleanly with master (but not this branch). Is there some way to add it to this PR, or should I open a new one? Btw, could you give some idea of what level of unit test coverage is needed to get this merged? |
|
I'd say new PR is best. There's no specific standard on test coverage, but of course the more the merrier |
|
I agree with @snoyberg . You could technically submit a PR to my repository on the |
|
Closing as #58 provided a mergeable solution for the issues discussed here. Special thanks to @pavelkogan for finishing this feature. |
This is basically a draft that adds three sets of functions:
yieldWhileJustfrom this SO issue)For most projects I've been using HXT, mostly because of the lack of these functions (especially 2) and 3): You had to parse absolutely everything or nothing would work).
Just as for
tagand related functions, more flexible functions (using predicates) and easier-to-use functions (using a singleName) have been added.From the library user's standpoint, this pull request mainly provides the new function
many'that ignores anything (i.e. content, attributes and entire subtrees) if the consumer does not match.Therefore it is now possible to parse this XML document:
by only replacing
manywithmany'inparsePeople = tagNoAttr "people" $ many parsePersonin the example. Additionally, a result-streaming counterpartmanyYield'exists.I think the implementation is somewhat incomplete and could probably be improved significantly but I'd like to hear your opinion on it.
Please feel free not to merge if this doesn't fit your needs or you'd like something to be done differently (hints will be appreciated)! I might also be unaware of some characteristics of the new functions.