[XML-SIG] Processing xml files with ISO 8859-1 chars
Rodrigo Senra
rodsenra@gpr.com.br
Wed, 07 Nov 2001 12:12:58 -0200
Hi,
I don't know if I stepped in a bug or it is just my newbieness ;o)
Trying to parse the file:
------------------- pau.xml -------------------
<note>
<assunto>
This line is ok.
This line has characters ISO-8859-1 with accents: Houve mudanças nos
preços?
Linha ok.
</assunto>
</note>
------------------ end of file pau.xml --------
with the script:
------------------ file teste.py ----------------------------
from xml.dom.ext.reader import Sax2
from xml.dom.ext import PrettyPrint
doc = Sax2.FromXmlStream(open('pau.xml'))
PrettyPrint(doc,encoding='iso-8859-1')
-------------------- end of teste.py script ------------
produces:
----------- stdout trace -------------
<?xml version='1.0' encoding='iso-8859-1'?>
<!DOCTYPE note>
<note>
<assunto>
This line is ok.
Linha ok.
</assunto>
</note>
----------- end of trace -------------
Am I doing something obviously wrong ? Should I try another parser ?
TIA
Senra
Rodrigo Senra
Computer Engineer (GPr Sistemas Ltda) rodsenra@gpr.com.br
MSc Student (IC - UNICAMP) Rodrigo.Senra@ic.unicamp.br
http://www.ic.unicamp.br/~921234 (LinUxer 217.243) (ICQ 114477550)