On Thu, Feb 19, 2009 at 12:53 PM, Thomas A. Schmitz
<[email protected]> wrote:
>
> 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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : [email protected] / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to