[XML-SIG] Parsing a unicode string
konrad.hinsen at laposte.net
konrad.hinsen at laposte.net
Mon Oct 4 15:57:55 CEST 2004
Is there any straightforward way to parse XML data from an existing
Unicode string? I have found a procedure that works, but seems
unnecessarily complicated:
xml_data = xml_data.encode('utf-8')
xml_data = '\n'.join(xml_data.split('\n')[1:])
xml_data = '<?xml version="1.0" encoding="utf-8"?>\n' + xml_data
dom_tree = xml.dom.minidom.parseString(xml_data)
My first attempt was
dom_tree = xml.dom.minidom.parseString(xml_data)
and I still think that would be the nicest way.
Konrad.
--
---------------------------------------------------------------------
Konrad Hinsen
Laboratoire Léon Brillouin, CEA Saclay,
91191 Gif-sur-Yvette Cedex, France
Tel.: +33-1 69 08 79 25
Fax: +33-1 69 08 82 61
E-Mail: hinsen at llb.saclay.cea.fr
---------------------------------------------------------------------
More information about the XML-SIG
mailing list