19 Feb
2009
19 Feb
'09
2:10 p.m.
On Thu, Feb 19, 2009 at 12:53 PM, Thomas A. Schmitz
On Feb 19, 2009, at 11:39 AM, luigi scarso wrote:
FOO = etree.Element("FOO") emph = etree.Element("emph") [child.tag for child in foo.iterdescendants(tag = '{urn:oasis:names:tc:opendocument:xmlns:text:1.0}span' ) ]
['{urn:oasis:names:tc:opendocument:xmlns:text:1.0}span']
span = [child for child in foo.iterdescendants(tag = '{urn:oasis:names:tc:opendocument:xmlns:text:1.0}span' ) ][0] emph.text = span.text FOO.append(emph) etree.tostring(FOO)
'<FOO><emph>foo</emph></FOO>'
Excuse me for being dense: you mean all namespaces have to be explicitly expanded?
see http://codespeak.net/lxml/tutorial.html#namespaces -- luigi