gedongdong / phpquery

Automatically exported from code.google.com/p/phpquery
0 stars 0 forks source link

Fatal error: Uncaught exception 'Exception' with message 'Error loading XML markup' in C:\wamp\bin\php\php5.2.11\PEAR\phpQuery\DOMDocumentWrapper.php:296 #178

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
It seems that poorly formed XHTML doesn't parse well...

require('phpQuery.php');

$doc = 
phpQuery::newDocumentFileXHTML('http://www.soundonsound.com/sos/jul04/articles/s
ynthsecrets.htm');
echo $doc->html();
echo pq('<img/>')->html();

This generates the following stack trace:

Fatal error: Uncaught exception 'Exception' with message 'Error loading XML 
markup' in C:\wamp\bin\php\php5.2.11\PEAR\phpQuery\DOMDocumentWrapper.php:296
Stack trace:
#0 C:\wamp\bin\php\php5.2.11\PEAR\phpQuery\DOMDocumentWrapper.php(95): 
DOMDocumentWrapper->loadMarkupXML('?    <!DOCTYPE ...', NULL)
#1 C:\wamp\bin\php\php5.2.11\PEAR\phpQuery\DOMDocumentWrapper.php(63): 
DOMDocumentWrapper->loadMarkup('?    <!DOCTYPE ...')
#2 C:\wamp\bin\php\php5.2.11\PEAR\phpQuery\DOMDocumentWrapper.php(49): 
DOMDocumentWrapper->load('?    <!DOCTYPE ...', 'application/xht...', NULL)
#3 C:\wamp\bin\php\php5.2.11\PEAR\phpQuery.php(497): 
DOMDocumentWrapper->__construct('?    <!DOCTYPE ...', 'application/xht...', 
NULL)
#4 C:\wamp\bin\php\php5.2.11\PEAR\phpQuery.php(408): 
phpQuery::createDocumentWrapper('?    <!DOCTYPE ...', 'application/xht...')
#5 C:\wamp\bin\php\php5.2.11\PEAR\phpQuery.php(448): 
phpQuery::newDocumentFile('http://www.soun...', 'application/xht...')
#6 D:\System Toy Chest\getss.php(4): 
phpQuery::newDocumentFileXHTML('http://www. in 
C:\wamp\bin\php\php5.2.11\PEAR\phpQuery\DOMDocumentWrapper.php on line 296

Original issue reported on code.google.com by harikara...@gmail.com on 15 Mar 2011 at 10:36

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
try ::newDocumentHTML or  ::newDocumentXML instead

Original comment by uranus...@gmail.com on 25 Nov 2011 at 2:24