Closed SDJeff closed 3 months ago
Hey @SDJeff!
This is the expected behaviour - when there are multiple child elements with the same name, the library will decode it into an array of values. If you are looking to have the attributes on the element, you can try using $reader->elements()
instead which is slightly harder to traverse, but gives you an array of Element
classes which contains all of the information.
You could also read the REMARK
property separately with the $reader->element()
method. You can use dot-notation to find the node:
$elements = $reader->element('orderpositions.remark')->get(); // [Element::class, Element::class]
foreach($elements as $element) {
$attributes = $element->getAttributes(); // e.g 'type' => 'order'
}
with
$reader->values()
the result looks like thisHow to keep the attributes as keys?