registering entities with sax parser

Ralf Schmitt ralf at brainbot.com
Tue Jun 8 18:55:10 CEST 2004


Hi,
is there a way to register entity definitions with a sax parser?
I want the following program to work without specifying an DTD in the
xml document.

from xml.sax import  handler, make_parser

class Parser(handler.ContentHandler):
    def startElement(self, name, attrs):
        print name, attrs['foobar']

doc = '''<?xml version="1.0"?>
<note bla="ä"></to>
</note> '''

make_parser().feed(doc).close()

Thanks for any help,
- Ralf

-- 
brainbot technologies ag
boppstrasse 64 . 55118 mainz . germany
fon +49 6131 211639-1 . fax +49 6131 211639-2
http://brainbot.com/  mailto:ralf at brainbot.com



More information about the Python-list mailing list