[Tutor] xml.dom.minidom key error

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Thu Sep 9 22:06:46 CEST 2004

On Wed, 8 Sep 2004, Ajay wrote:

> i am parsing the attached document.
> the code is
> from xml.sax import make_parser
> from xml.dom.minidom import parse
> parser = make_parser('xml.sax.drivers2.drv_xmlproc')
> ruleSet = parse(ruleSetFile, parser=parser)

Hi Ajay,

Hmmm... I haven't had time to look at this yet!  Has anyone answered you
about this?

You may want to resend your question to the python-XML mailing list and
see if anyone there can help with it.  I may have some time later, but you
may not want to wait for me... *grin*

Here's the URL for the Python-XML mailing list:


Try to ask your question there; you may get better responses there.

To help debug the problem, we need that 'ruleSetFile', or at least a small
subset of it, since the problem appears sensitive to the XML content.  In
fact, the error that you're getting:

>   File
> "C:\PYTHON23\Lib\site-packages\_xmlplus\sax\drivers2\drv_xmlproc.py", lin
> e 368, in handle_start_tag
>     AttributesNSImpl(attrs, rawnames))
>   File "C:\PYTHON23\Lib\site-packages\_xmlplus\dom\pulldom.py", line 98, in
> star
> tElementNS
>     prefix = self._current_context[a_uri]
> KeyError: u'http://www.w3.org/2001/02/appelv1'

looks really funky, and looks like it might have to do with XML
namespaces.  I'm not sure about this, but it may even be a bug in the
pulldom module.  We can't be sure until we trace the problem down.  And
for that, it'll really help if we can use that ruleSetFile to test the
parser out.

When you resend them your question, either attach your 'ruleSetFile' to
the message if it's small, or post the 'ruleSetFile' on the web where
someone can use it to investigate the problem.

Good luck to you!

More information about the Tutor mailing list