Ho un grosso problema con PHP DOMDocument :: validate() che sembra chiedere sistematicamente il DTD.DOMDocument :: validate() problem
È un grosso problema quando desidero convalidare, ad esempio, un documento XHTML as explained here.
Come w3.org sembra rifiutare ogni richiesta da un server PHP, è impossibile convalidare il mio documento con questo metodo ...
non v'è alcuna soluzione per questo?
Grazie di anticipo
[EDIT] Ecco alcune precisazioni:
/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
correlati domanda:
Non so che cosa il problema è. 'DOMDocument :: validate' convalida il documento in base al DTD del documento caricato. – Gordon
Ad esempio, se fornisco questo DTD: http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd, quando chiamo DOMDocument :: validate(), PHP invia una richiesta per ottenere il file , ma w3.org risponde sistematicamente con un servizio 403 Proibito o 503 non disponibile e PHP mi invia l'avviso: impossibile caricare l'entità esterna "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional. dtd " –
Vedo, sì. C'è un bug aperto per questo: http://bugs.php.net/bug.php?id=48080 – Gordon