Bug #49325 Error in domdocument->schemaValidate
| From: | Israel Ekpo | Date: | Mon, 05 Oct 2009 16:11:17 +0000 |
| Subject: | Bug #49325 Error in domdocument->schemaValidate | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-45663@lists.php.net to get a copy of this message | ||
This was actually not a bug with the PHP code.
The error was in the instance XML document.
I just closed the bug.
The contents of the element node did not conform to what is specified in
the XSD. After adjusting the contents of the instance XML document to
conform to the specifications of the XSD document, it worked as expected.
The original file is here :
http://israelekpo.com/php_bugs/NFe/4309080311661100019855001000000001070
0000127.xml
The corrected version is here :
http://israelekpo.com/php_bugs/NFe/4309080311661100019855001000000001070
0000127.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
--
"Good Enough" is not good enough.
To give anything less than your best is to sacrifice the gift.
Quality First. Measure Twice. Cut Once.