xml-to-array
xml-to-array copied to clipboard
Two child nodes with same name
When using parseXml( );
and the XML file has for example two node child's with similar names one of them gets replaced instead of getting grouped together
<?xml version="1.0" encoding="UTF-8"?>
<cbc:ID>1616</cbc:ID>
<OrderResponse>
<cac:OrderLine>
<cac:LineItem>
<cbc:ID>1</cbc:ID>
</cac:LineItem>
<cac:OrderLineReference>
<cbc:LineID>1.00</cbc:LineID>
</cac:OrderLineReference>
</cac:OrderLine>
<cac:OrderLine>
<cac:LineItem>
<cbc:ID>2</cbc:ID>
</cac:LineItem>
<cac:OrderLineReference>
<cbc:LineID>2.00</cbc:LineID>
</cac:OrderLineReference>
</cac:OrderLine>
</OrderResponse>
This behavior is to be expected. When you're working with arrays and you have two same-level keys with the same name, the second one will overwrite the first.
This behavior is to be expected. When you're working with arrays and you have two same-level keys with the same name, the second one will overwrite the first.
Could you make it merge similar keys as nested-array?