Example:
I have two XML files containing the exact same data, structured in a format similar to the XML below. I have converted these two files into SimpleXMLElement Objects. I now want to use PHP to loop through each element and its data in both SimpleXMLElement Objects and compare them to make sure they are the same.
I was looking at the accepted answer at this solution for help but struggling to figure out how to apply it to my own code. Compare SimpleXml Object
The code should be able to compare any two XML files so I cant apply the second solution as the properties will vary across XML files so I can't define them explicitly. Using asXML seems to ignore the attributes which also need to be checked to ensure no changes have been made.
<container name="test">
<typedef name="stringdef">
<type name="enumeration">
<enum name="succeeded">
<value value="5"/>
<description>
<text>Test for succeed</text>
</description>
</enum>
<enum name="failed">
<value value="1"/>
<description>
<text>Test for fail</text>
</description>
</enum>
</type>
<description>
<text>Enum description</text>
</description>
</typedef>
</container>