I’m having a real issue trying to parse an XML file that is structured in the following way using PHP.
As you might notice, they are key->value pairs, but it could be key->string or key->data etc.
Anyone got an idea? I’d really appreciate the help.
Also, data is from an external interface and I have no control over it’s formatting.
<array>
<dict>
<key>name</key>
<string>John</string>
<key>surname</key>
<string>Smith</string>
<key>Car</key>
<string>Ford</string>
<key>picture</key>
<data>AAAA====</data>
<key>age</key>
<string>32</string>
</dict>
</array>
I would like to somehow re-format the data with something simple, such as:
array
-dict
-name=John
-surname=smith
etc.
Take a look at simplexml class: http://php.net/simplexml
Also, XML has a standard, so even though your XML is coming from external interface, they should be a standard, valid XML.
EDIT