`find` (and friends) handles `namespaces` badly
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
lxml |
Fix Released
|
Medium
|
scoder |
Bug Description
LXML 2.3.6.0
I am working on an application where a tar archive containing xml-files using different schemas must be processed (and the results written to a database). In this application, a call `elem.find('N:tag', namespaces=ns)` returns `None` event though the first child of `elem` matches (and `elem.xpath(
The analysis revealed that `find` (and friends) uses the cache `lxml._
Following a small script showing the problem:
>>> from lxml.etree import XML
>>> e = XML("<root xmlns='ns'><a /></root>")
>>> e.find("N:a", namespaces=
>>> e.find("N:a", namespaces=
>>> from lxml._elementpath import _cache; _cache.clear()
>>> e.find("N:a", namespaces=
<Element {ns}a at 0xb74f3e8c>
http:// lxml.de/ tutorial. html#namespaces