Re: xpath with big files

2008-05-21 Thread Stefan Behnel
Vladimir Kropylev wrote:
> I've encountered a problem when trying to use lxml.etree.xpath with
> big (63Mb) file. It returns empty list on any request.
> Is there any restriction on file size for lxml.etree.xpath?

No.


> This is what I do:
> 
> f=open(filename)
> tree = etree.parse(f)
> f.close()

Consider using

   tree = etree.parse(filename)


> r = tree.xpath('//image')
> print(r)
> 
> it prints:
> []
> 
> What is wrong here?

Does your document use namespaces? In that case, asking for an unnamespaced
"image" will not get you any result.

Stefan
--
http://mail.python.org/mailman/listinfo/python-list


xpath with big files

2008-05-21 Thread Vladimir Kropylev
Hi,
I've encountered a problem when trying to use lxml.etree.xpath with
big (63Mb) file. It returns empty list on any request.
Is there any restriction on file size for lxml.etree.xpath?

This is what I do:

f=open(filename)
tree = etree.parse(f)
f.close()
r = tree.xpath('//image')
print(r)

it prints:
[]

What is wrong here?
--
http://mail.python.org/mailman/listinfo/python-list