I would create something like a template (either in code or read from a file) and compare the content of the template with the xml file that you have parsed.
I'm not familiar with libxml, if your result is in an hashed array and your template as well you can do something like in below (some kind of just invented pseudo code)
Code:
set fail false
foreach element in template
{
if {data[element]!=template[element]} {
set fail true
}
}
return fail