note 97428 added to domdocument.load
| From: | _michael at osu1 dot php dot net | Date: | Mon, 19 Apr 2010 14:50:36 +0000 |
| Subject: | note 97428 added to domdocument.load | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-168415@lists.php.net to get a copy of this message | ||
XHTML and entities: The solution proposed below by zachatwork at gmail dot com didn't work for
me. I checked on a number of servers (both LAMPP and WAMPP) - on each of them, calling loadXML()
with the LIBXML_DTDLOAD option triggered an external request for the DTD. And that's bad news.
If allow_url_fopen is turned off, the request for the DTD fails with a warning. If it is turned on,
the request fails because these w3c URLs return a 503 Service Unavailable.
HTML entities still generate a warning in either case.
The best solution, as far as I can tell, is simply to ignore the warnings and suppress them using
'@'. I can't recommend parsing XHTML with loadHTML() instead of loadXML() - yes, you
get rid of the entity problem, but loadHTML() changes the source while parsing it (tries to
'fix' it even though there is nothing to fix).
----
Server IP: 212.124.37.9
Probable Submitter: 91.57.111.164
----
Manual Page -- http://www.php.net/manual/en/domdocument.load.php
Edit -- https://master.php.net/note/edit/97428
Del: integrated -- https://master.php.net/note/delete/97428/integrated
Del: useless -- https://master.php.net/note/delete/97428/useless
Del: bad code -- https://master.php.net/note/delete/97428/bad+code
Del: spam -- https://master.php.net/note/delete/97428/spam
Del: non-english -- https://master.php.net/note/delete/97428/non-english
Del: in docs -- https://master.php.net/note/delete/97428/in+docs
Del: other reasons-- https://master.php.net/note/delete/97428
Reject -- https://master.php.net/note/reject/97428
Search -- https://master.php.net/manage/user-notes.php