private function loadXML($data, $source)
{
$entities = array();
try {
$doc = \SAML2\DOMDocumentFactory::fromString($data);
} catch (Exception $e) {
throw new Exception('Failed to read XML from ' . $source['src']);
}
if ($doc->documentElement === NULL) {
throw new Exception('Opened file is not an XML document: ' . $source['src']);
}
$entities = SimpleSAML_Metadata_SAMLParser::parseDescriptorsElement($doc->documentElement);
return $entities;
}