I have a large XML file and I would like to use XMLReader for validating it against xsd schema.
I wrote the following code:
$xmlReader = new XMLReader();
libxml_use_internal_errors(true);
$open = $xmlReader->open(APPLICATION_PATH.'/../public/Test feed from Charles.XML');
$schema = $xmlReader->setSchema(APPLICATION_PATH.'/../public/schema/2.1/ONIX_BookProduct_Release2.1_reference.xsd');
while($xmlReader->read()){
}
$errors = libxml_get_errors();
$xmlReader->close();
var_dump($errors);
Script output only one error, while file contains much more. How to correctly get validation error from XMLReader? Any working example will be very helpful.
No comments:
Post a Comment