xml:id attribute support
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
lxml |
Invalid
|
Undecided
|
Unassigned |
Bug Description
Hi,
Is there any way to specify an xml:id="someID" attribute in an lxml etree.Element. As far as I tried I got an exception from:
lxml.etree.
when doing either of the two following lines...
e = etree.Element(
e['xml:id'] = 'asd' # for e being a etree.Element. Throws too.
The stacktrace in that case becomes:
/usr/lib/
/usr/lib/
/usr/lib/
/usr/lib/
/usr/lib/
/usr/lib/
Do I need to specify a XML Standard namespace describing the attribute in order to legalize it for lxml? Or is it unintended behavior?
#####
Python : sys.version_
lxml.etree : (3, 4, 0, 0)
libxml used : (2, 9, 1)
libxml compiled : (2, 9, 1)
libxslt used : (1, 1, 28)
libxslt compiled : (1, 1, 28)
#####
Best regards,
~Arlias
Found the proper way to do it, by specifying {http:// www.w3. org/XML/ 1998/namespace}id as the namespace with the <id> as the value. Probably not the best way to deal with it (not really intended for this I suppose) but works for me.