[4suite] [Amara] attribute names that contain hypens
Uche Ogbuji
uche at ogbuji.net
Thu Dec 14 23:15:13 MST 2006
Uche Ogbuji wrote:
> The manual explains that characters that are illegal in Python names are
> turned to underscores:
>
>> Option #1
>> titles = data.doc.xml_xpath (u'//title')
>>
>> for titleeach in titles:
>> del titleeach.title-type
>
> That would be
>
> del titleeach.title_type
>
> You can always use
>
> del titleeach.xml_remove_child(xml_xpath(u'title-type'))
>
> if you want to use the proper XML name.
Actually I completely forgot the mapping protocol support. You can do:
del titleeach.[u'title-type']
I just beefed up the manual quite a bit to explain all this better.
Thanks for the impetus to do so. I also found a subtle bug in doing so,
which is now fixed.
--
Uche Ogbuji Work: The Kadomo Group, Inc.
http://uche.ogbuji.net http://kadomo.com
http://copia.ogbuji.net Lead dev at http://4Suite.org
Articles: http://uche.ogbuji.net/tech/publications/
More information about the 4suite
mailing list