I am trying to parse a larger xml file and it has lots of namespaces and is rather complex.
Here is an example of a the entry in the root that I would like to parse: http://pastebin.com/zJGQZBMV
And this is my PHP Script:
private function importFromFile()
{
$result = false;
$xmlFile = simplexml_load_file($this->getSavedFile());
foreach($xmlFile->children() as $entry){
$entry->registerXPathNamespace("vuln", "http://scap.nist.gov/schema/vulnerability/0.4");
var_dump($entry->{"vuln:cve-id"}) ;
break;
}
return $result;
}
However, it does not show the CVE Id. Could it be, because of the Namespace ? I receive:
object(SimpleXMLElement)#6 (0) { }
I followed: Parse XML with Namespace using SimpleXML
Kind regards, Richard