[lxml-dev] Strange ValueError
pythonalex at email.it
pythonalex at email.it
Mon Dec 15 11:11:27 CET 2008
Hello everyone. I'm Alessio Esposito and collaborate with the Institute
of Cybernetics of the CNR in Pozzuoli (NA) - Italy,
I have the latest version of lxml (lxml 2.1.4).
I need to have something like this:
...
<octapyelement xsi:schemaLocation="http://octapycms.remuna.org/schema.xsd">
<octapy:first> something </octapy:first>
<octapy:second> something </octapy:second>
...
...
</octapyelement>
...
And this is the python code:
...
e_octapy = SubElement(rootelement, 'octapyelement')
e_octapy.set('{%s}schemaLocation' % NS_XSI,
'http://octapycms.remuna.org/schema.xsd')
for sub_elem in struct:
e = SubElement( e_octapy, sub_elem )
e.text = 'something'
...
The variable sub_elem contain strings octapy:first, octapy:second etc.
The problem is that the latest version of lxml does not accept that sub_elem
contains ':' .
This is a part of the terminal output:
Module lxml.etree, line 2342, in lxml.etree.SubElement
(src/lxml/lxml.etree.c:%u)
Module lxml.etree, line 160, in lxml.etree._makeSubElement
(src/lxml/lxml.etree.c:%u)
Module lxml.etree, line 1311, in lxml.etree._tagValidOrRaise
(src/lxml/lxml.etree.c:%u)
ValueError: Invalid tag name u'octapy:first'
The previous version of lxml (lxml 2.1) whit the same code gave no problems.
How can I fix this?
Kind regards, Alessio.
--
Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e SMTP
autenticato? GRATIS solo con Email.it: http://www.email.it/f
Sponsor:
CheBanca! La prima banca che ti dà gli interessi in anticipo.
Fino al 4,70% sul Conto Deposito, zero spese e interessi subito. Aprilo!
Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=8435&d=20081215
More information about the lxml-dev
mailing list