ID: 49325 Updated by: ie...@php.net Reported By: bernardo at datamex dot com dot br -Status: Open +Status: Closed Bug Type: DOM XML related Operating System: Freebsd 7 PHP Version: 5.2.10 Assigned To: iekpo New Comment:
This was actually not a bug with the PHP code. So this bug should be closed. The error was in the instance XML document. The contents of the element node did not conform to what is specified in the XSD. The original file is here : http://israelekpo.com/php_bugs/NFe/43090803116611000198550010000000010700000127.xml The corrected version is here : http://israelekpo.com/php_bugs/NFe/43090803116611000198550010000000010700000127.correct.xml PHP Code to verify success : http://israelekpo.com/php_bugs/NFe/bug_49325.phps <?php $xml = new DomDocument(); $xml->load('43090803116611000198550010000000010700000127.correct.xml'); $tempDom = new DOMDocument(); $tempDom->loadXML(utf8_encode($xml->saveXML())); if ($tempDom->schemaValidate('nfe_v1.10.xsd')) { echo "ok"; } else { echo "erro"; } ?> Expected result: ---------------- ok Actual result: -------------- ok Previous Comments: ------------------------------------------------------------------------ [2009-10-05 15:18:27] ie...@php.net I am going to take on this one. I will provide feedback later in the day. ------------------------------------------------------------------------ [2009-08-21 19:47:00] bernardo at datamex dot com dot br Description: ------------ erros na validação de xsd coisas do tipo Error: Element '{http://www.portalfiscal.inf.br/nfe}IE': [facet 'pattern'] The value 'ISENTO' is not accepted by the pattern '[0-9]{0,14}|ISENTO|PR[0-9]{4,8}'. o php esta em iso-8859-1 o xml esta em utf-8 xsds in http://www.bernardosilva.com.br/NFe.rar xml in http://www.bernardosilva.com.br/43090803116611000198550010000000010700000127.xml Reproduce code: --------------- $xml = new DomDocument(); $xml->load('43090803116611000198550010000000010700000127.xml') $tempDom = new DOMDocument(); $tempDom->loadXML(utf8_encode($xml->saveXML())); if ($tempDom->schemaValidate('nfe_v1.10.xsd')) echo "ok" else echo "erro" Expected result: ---------------- ok Actual result: -------------- erro ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=49325&edit=1