I have a really complicated XML file(in my opinion). It contains multiple namespaces(prefixes) and I am trying to convert it to an object.
So at first we were using this function
simplexml_load_file("file.xml");
file.xml looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<animal:race>
<animal:dog>
<specification:color>Black</specification>
</animal:dog>
<animal:cat>
<animal:name>Flappie</animal:name>
</animal:cat>
</animal:race>
At first the function returned an empty object. Then we found out that you have to specify prefixes like this:
simplexml_load_file("file.xml",null,null,"animal");
This returned an object but without all the other prefixes like: specification. So the object became:(outputted as an array
object(animal:race)#1 (2) {
["dog"]=> object(SimpleXMLElement)#2 (0) {
}
["cat"]=> object(SimpleXMLElement)#2 (1) {
[animal:name] => string "flappie"
}
}
So my conclusion is that we need our other namespaces to be "included" to.. cause specifications arent shown.