Error with multi-level XML documents #35
prochst
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I am using this library for parsing XML feeds and I have encountered an error if the xml document contains multilevel elements. If the multilevel element is at the end of the record, everything is OK, but if it is followed by one or more simple elements in the record, then the multilevel element is dropped from the parsing result.
Example of XML data:
Parse function:
and result is:
array(2) { ["node_id"]=> string(12) "98b9b3498bd0" ["product_name"]=> string(23) "Unit test of aplication" }
If the <PRODUCT_FEATURES> element was at the end, the result is correct.
The problem is in the function
protected function parseValueCollection(SimpleXMLElement $content, array $uses): array
On a multi-level element, the $value variable is not updated, and on a subsequent loop with a single element, $result is overwritten with the non-updated $value.
Beta Was this translation helpful? Give feedback.
All reactions