Tengo un gran problema con PHP DOMDocument :: validate() que parece preguntar al DTD sistemáticamente.DOMDocument :: validate() problema
Es un gran problema cuando quiero validar, por ejemplo, un documento XHTML as explained here.
Como w3.org parece rechazar toda solicitud de un servidor PHP, es imposible para validar mi documento con este método ...
¿Hay alguna solución para esto?
Gracias por adelantado
[EDIT] He aquí algunas precisiones:
/var/www/test.php:
<?php
$implementation = new DOMImplementation();
$dtd = $implementation->createDocumentType
(
'html', // qualifiedName
'-//W3C//DTD XHTML 1.0 Transitional//EN', // publicId
'http://www.w3.org/TR/xhtml1/DTD/xhtml1-'
.'transitional.dtd' // systemId
);
$document = $implementation->createDocument('', '', $dtd);
$document->validate();
Warning: DOMDocument::validate(http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd): failed to open stream: HTTP request failed! HTTP/1.0 403 Forbidden
in /var/www/test.php on line 14
Warning: DOMDocument::validate(): I/O warning : failed to load external entity "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" in /var/www/test.php on line 14
Warning: DOMDocument::validate(): Could not load the external subset "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" in /var/www/test.php on line 14
Relacionados pregunta:
No estoy seguro que su problema es. 'DOMDocument :: validate' valida el documento basado en la DTD del documento cargado. – Gordon
Por ejemplo, si proporciono este DTD: http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd, cuando llamo a DOMDocument :: validate(), PHP envía una solicitud para obtener el archivo , pero w3.org responde sistemáticamente con un 403 Forbidden o un 503 Service Unavailable, y PHP me envía la advertencia: no se pudo cargar la entidad externa "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional. dtd " –
Ya veo, sí. Hay un error abierto: http://bugs.php.net/bug.php?id=48080 – Gordon