I have a XML data coming from API response, before I process the data insertion I wanted to check the data integrity. So, needs to validate the XML data with the XML file located in my system. When I used the code below :
$xsdPath = DOCUMENT_ROOT."/filePath/ssoResponse_xmlFormat.xsd";
$xml = new \DOMDocument();
$val = $xml->loadXML($xmlData); //$xmlData is XML data passed through function argument.
if (!$xml->schemaValidate($xsdPath)) {
//$xml->schemaValidate($xsdPath);
return $this->libxml_display_errors();
}else {
return true;
}
I'm getting an error as :
Fatal Error 4: Start tag expected, '<' not found on line 1
Error 1872: The document has no document element. on line -1
Working with Zend Framework 2..
Thanks in advance..
No comments:
Post a Comment