$xml_string =
"<note>
<to>Tom</to>
<from>R2D2</from>
<heading>Reminder</heading>
<body>Don't forget the Commodore 128</body>
</note>";
$xml = simplexml_load_string($xml_string);
if ($xml === false) {
print "Invalid XML";
} else {
print "Valid XML";
}
/*
run:
Valid XML
*/