registering entities with sax parser

R

Ralf Schmitt

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="&auml;"></to>
</note> '''

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

Thanks for any help,
- Ralf
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,981
Messages
2,570,188
Members
46,733
Latest member
LonaMonzon

Latest Threads

Top