failure to locate elements #7

Open
gawel opened this Issue Nov 28, 2012 · 2 comments

Projects

None yet

2 participants

@gawel
Owner

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

@yodalee

initial trace, there is a slightly difference on pyquery.py:69
f2.html will cause "etree.XMLSyntaxError" by the &copy, and use lxml.html parser to parse the result, and get the right result OAO

@yodalee

I think this is related to issue #31, that XMLSyntaxError cause lxml use html parser, and get the right result in the end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment