[XML-SIG] Empty dom class returned after parsing a valid XML file
luc willems
Willems.luc@pandora.be
Thu, 17 Apr 2003 19:51:56 +0200
Hello All ,
i have a problem with pyexpat and sax2 parser of the pyxml-0.8.2 packages.
I developed a small script that manipulates some xmls files on my development
system (SuSE 8.1 , python 2.2.1 , pyxml 0.8.2 ) . This script together with
the test XML files worked fine.
But when i moved the script to a Soloris 2.8 with custom build python 2.2.2
and pyxml 0.8.2 it doesn't work any more . to be precise ,
following code returns a 'None' instead of a DOM class for the "dom" variable
---------------------------------------------------------------------------------
#open input file or use STDIN
if opts.has_key("--in-file"):
try:
fi = open(opts["--in-file"], 'rb')
except:
# print help information and exit:
(exctype,value,trace)=sys.exc_info()
showerror("FILE",value)
sys.exit(2)
else:
fi = sys.stdin
# Try parsing the input file , exit if problems arise
try:
reader = PyExpat.Reader()
dom = reader.fromStream(fi) <---- returns 'None' on solaris !!!!
except:
(exctype,value,trace)=sys.exc_info()
showerror("XML",value)
sys.exit(3)
if dom == None:
showerror("EXPAT","No DOM class after parsing")
sys.exit(3)
- xml file ------------------------------------
<?xml version='1.0' encoding='UTF-8'?>
<config>
<master port='12345' host='master.ikke.be'/>
<node type='slave'/>
<snmp secret='you-dont-know-it' host='mieke.be'/>
<statepath>/tmp</statepath>
<test><![CDATA[function matchwo(a,b)]]></test>
</config>
-----------------------------------------------
When i run this code with a simple xml file , it returns 'None' on solaris
and a parsed DOM on my linux system. I tried using the PyExpat and Sax2
parsed , both give the same problem.
Note : python and pyxml are both compiled with gcc-3.2.2 on solaris
luc