[XML-SIG] Problem with entities

Patrick Gaherty pgaherty@chambersharrap.co.uk
Thu, 07 Mar 2002 10:18:03 +0000


I'm using the XMLGenerator class from saxutils (PyXML 0.7) and I'm having 
problems with entities. To start off with I'm just trying to recreate the 
original XML input file. ie

class Generator(saxutils.XMLGenerator):

         def startElement(self,name,attrs):
                 saxutils.XMLGenerator.startElement(self,name,attrs)

         def endElement(self,name):
                 saxutils.XMLGenerator.endElement(self,name)

         def characters(self,content):
                 saxutils.XMLGenerator.characters(self,content)


fout1 = re.sub(r'\.', '_tmp.', sys.argv[1])
output = open(fout1, 'w')
p = make_parser()
p.setContentHandler(Generator(output))
p.parse(sys.argv[1])

This works a treat, except I'm losing any entities I've declared in my DTD 
(ie œ). Ideally I'd like them to appear in the output untouched. Any 
help to point me in the right direction would be greatly appreciated.

Thanks

Patrick Gaherty