pyquery
pyquery copied to clipboard
failure to locate elements
Lane Stevens created an issue 2012-07-18
I have include two files. The first file is a proper subset of the second. In the first file, the p and div elements are not found. In the second file the p and div elements are correctly found.
This issue was found in using PyQuery via WebTest but it fails when using PyQuery directly. The version in use is 1.2.1.
Example:
from pyquery import PyQuery
f = open('f1','r')
s = f.read()
f.close()
d = PyQuery(s)
print len(d('p')) #should be 1 for both files
Files at https://bitbucket.org/olauzanne/pyquery/issue/54/failure-to-locate-elements
initial trace, there is a slightly difference on pyquery.py:69 f2.html will cause "etree.XMLSyntaxError" by the ©, and use lxml.html parser to parse the result, and get the right result OAO
I think this is related to issue #31, that XMLSyntaxError cause lxml use html parser, and get the right result in the end.