hein, 27.01.2011 19:16:
The other day i was processing an xml tree using lxml.etree. That tree
contained a namespace. During that processing i inserted an element.
Later on
i tried to find that element using xpath. And to my suprise that
element was
not found! Maybe my suprise is just the result of my marginal
knowledge about xml namespaces.
After some examination i found out that the reason for not finding the
element
was that i did not supply a namespace when inserting the element.
[...]
I have two questions on this:
- Is what i am seeing expected behavior?
Yes. It's a common problem for new users, though.
- How am i supposed to detect a missing namespace, if there are no
differences
in the serialized representation? (That's what i initially used to
debug the problem.)
This is a known problem of XML namespaces, which were only designed as an
add-on to XML after the fact. The only advice I can give: be careful with
the default namespace.
Stefan
--
http://mail.python.org/mailman/listinfo/python-list