SGMLParser questions

Tung Wai Yip tungwaiyip at yahoo.com
Tue Apr 22 20:17:36 EDT 2003


I'm using SGMLParser to parse HTML. It works great in handling the lax
HTML format. I have a few questions however:

1. unknown_starttag(tag, attributes) - why is 'attributes' a list of
(name, value) pairs instead of a dictionary? I incline to use
something like

  attributes.get['src']

but this doesn't work for the list. Is there some short cut to
retrieve value in a list of (name, value) pairs?

2. Does it supports namespace?

3. handle_starttag() turn tags into lower case. This work perfectly
for HTML. But can it works case sensitively?

Wai Yip Tung





More information about the Python-list mailing list