FromXMLString wanted.

Jaros³aw Zabie³³o (delete .PL) webmaster at apologetyka.com.pl
Fri May 3 08:29:24 EDT 2002


On Wed, 1 May 2002 12:07:39 +0200 (MET DST), Doru-Catalin Togea
<doru-cat at ifi.uio.no> wrote:

>I am doing some pretty basic XML parsing using pyxml. My xml data
>(not the tags) contains non-english characters. pyxml for ActiveState
>Python 2.0 did not complain about that even when I did not provid an
>opening line in the xml file stateing the encoding used, like:
>
><?xml version = '1.0' encoding = 'iso-8859-1'?>
>
>Strange, but true, and I could live with that.
>
>I have now upgraded to ActiveState Python 2.2, pyxml 0.7, and it complains
>for the existence of non english characters, EVEN WHEN SPECIFYING THE
>ENCODING, as above! Strange again, and unfortunatlly I can not live with
>that. :-)

Do your xml file open correctly in Internet Explorer 6.0? It has quite
good parser. I am using xml.minidom for reading xml ant it works fine
with non-English characters. Eg. 

from xml.dom import minidom
xmlDoc = minidom.parse(myFilename)
# the following depends on content of your file
for myNode in xmlDoc.getElementsByTagName('myXmlTag'):
	print myNode.firstChild.data
xmlDoc.unlink()

--
Jarosław Zabiełło (UIN: 6712522)
URL: http://3585753410/~zbiru



More information about the Python-list mailing list