You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The price attribute currency is nowhere to be found in the resulting PHP array.
Has there been any discussion on how to tackle this issue? That is a pretty important part of XML parsing, to be able to get the attributes of elements.
Thanks!
The text was updated successfully, but these errors were encountered:
Converting SimpleXML to an array (whether via JSON encode/decode or not) loses a lot of information, mostly because of how SimpleXML implements array conversion internally. Because it treats child elements as object properties, but attributes as array keys, converting to a simple array creates somewhat of a conflict in how to maintain this distinction, so the SimpleXML developers opted to simply discard attributes as being generally less important than contents.
Because this project is meant to abstract away, somewhat, the format used to input the data, so you can work with that data consistently regardless of how it was presented, it can only support the features of the simplest input type (which is probably Query String, meaning everything will be an array).
If you definitely need something more advanced, and the abstraction layer isn't all that important to you, consider using SimpleXML directly.
When using the XML parser, it does not take into account any attributes that might have been defined for an element.
Example:
The price attribute
currency
is nowhere to be found in the resulting PHP array.Has there been any discussion on how to tackle this issue? That is a pretty important part of XML parsing, to be able to get the attributes of elements.
Thanks!
The text was updated successfully, but these errors were encountered: