-
Notifications
You must be signed in to change notification settings - Fork 15
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
Call to getChildElements() makes the iteration skip steps #3
Comments
Well, it is actually intended to work that way however, as I could reproduce your issue, it's broken. I'm working on a fix, but until then for your scenario, a working variant is to iterate the child elements via SimpleXMLElement:
This should work equally well for the moment. Let me know if you run into any issues with that. |
Glad you could reproduce the issue, and thanks a lot for the workaround, I'll try that tomorrow. |
getChildElements()
makes the iteration skip steps ?
well actually it's not really correct to say this is a flaw. Because XMLReader is forward only, such a sub-iterator can not find out that it's done until it has moved on to the next (invalid) element. In your case, that is the next I have to check the invalidation decision for the child iterator here. it should be possible to stop at the closing tag. This should prevent the issue. |
So both iterators are not so independent, if I get this correctly. They seem to share some kind of cursor, don't they ? Thanks for the explanations, it's very interesting. |
The workaround works like a charm! Thanks again! |
Well the "cursor" they share is XMLReader. I could not find time to fix that bug so far. Glad the alternative worked for you. Thank you for reporting this! |
@jwundrak Can you please show me an example of how you can iterate over child (or grand child) nodes without it skipping the parent nodes using |
I'm trying to read an xml file created with
mysqldump --xml
The code looks like this :
The importRow method loops over fields. It looks like this :
When I comment out the
importRow()
call I get the right number of iterations. When I do not, I get half, and only entities with even ids get imported. It is as if thegetChildElements()
call would make the pointer increase.Am I using the library wrong ?
The text was updated successfully, but these errors were encountered: