If you are not sure which XML APIs might be available
<?
$xmlfile = 'myfile.xml';
$classes = get_declared_classes();
if( in_array('SimpleXMLElement', $classes) ) {
$xmldoc = simplexml_load_file($xmlfile);
} elseif( in_array('DOMDocument', $classes) )
{
$xmldoc = new DOMDocument();
$xmldoc->load($xmlfile);
} else {
}
?>
Related examples in the same category