[lxml-dev] Handling namespaces in tags

Wietse Jacobs wietse.j at gmail.com
Fri Oct 24 10:30:24 CEST 2008


Hello,

First of all: thanks for a great library!

>> David Soulayrol wrote:
>> > Is there some utility with lxml to retrieve the namespace and the name
>> > of a tag...

> On Thu, 2008-10-23 at 21:49 +0200, Stefan Behnel wrote:
>> There isn't a dedicated utility function for it. I actually run into this
>> problem less frequently than one might think, as I rarely really need the tag
>> name where I can't use it together with the namespace. My guess is that this
>> happens most frequently where different XML languages are handled by the same
>> code.

I use lxml to handle XBRL and I often need this functionality.

2008/10/24 John Krukoff <jkrukoff at ltgc.com>:
> I can understand that there's some risks for future ElementTree
> compatibility, but a new attribute like Element.localtag or
> Element.localname (Possible name idea to pull terminology from XSLT
> local-name?) and Element.namespace would make it easy to use the parts
> independently.

+1 on Element.localname and Element.namespace.
(I have no opinion on the compatibility issue though.)

--
--Wietse


More information about the lxml-dev mailing list