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

Allow to parse of elements of multiple types #9

Merged
merged 4 commits into from
Aug 22, 2019

Conversation

setnicka
Copy link
Contributor

Sometimes there are multiple types of elements in the XML file (for example OSM export - it contains nodes, ways and relations) but for parsing this the three loops through the whole file were needed.

These changes allows to specify multiple elements to parse. It should be backward compatible for any normal usage of the xml-stream-parser because there are only added item into XMLElement struct and changed string argument to ...string.

This is needed step for distinguish elements of multiple types on the
user side (when calling "for xml := range parser.Stream()").
When creating XMLParser user could specify list of multiple names to
parse. Elements returned from parser.Stream() now embeds Name to
distinguish them.
@setnicka setnicka changed the title Allow to parse of oelements of multiple types Allow to parse of elements of multiple types Aug 21, 2019
@tamerh
Copy link
Owner

tamerh commented Aug 21, 2019

This look clean and useful. Tests are passing right? Some basic tests for this feature would be good.

@setnicka
Copy link
Contributor Author

I added tests for multiple tags parsing even with when they are nested (I expect only not nested occurrences should be returned). All tests are passing.

@tamerh tamerh merged commit 72eeeab into tamerh:master Aug 22, 2019
@tamerh
Copy link
Owner

tamerh commented Aug 22, 2019

Now merged and tagged with version v1.2.0. Thanks for this PR.

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

Successfully merging this pull request may close these issues.

2 participants