[XML-SIG] minidom parse error - keyerror

Ajay abra9823 at mail.usyd.edu.au
Thu Sep 9 06:34:16 CEST 2004


Quoting Alan Kennedy <alanmk at hotmail.com>:

> [Ajay]
> > i have tried the archives now and heaps of Google searches but am no
> closer
> > to finding out what the error is.
> >
> > the error does not appear if i use expat.
> and
> >>i am parsing the attached document.
> >>the code is
> >>parser = make_parser('xml.sax.drivers2.drv_xmlproc')
> >>ruleSet = parse(ruleSetFile, parser=parser)
> >>i get the following error
> >>
> >>Traceback (most recent call last):
> >>  File "C:\PYTHON23\Lib\site-packages\_xmlplus\dom\pulldom.py", line
> 98,
> >>in startElementNS
> >>    prefix = self._current_context[a_uri]
> >>KeyError: u'http://www.w3.org/2001/02/appelv1'
> Since I can't see your document, I can't say for sure.
> But by the look of that traceback, you have neglected to declare a
> namespace in your XML document. The error appears to occur when the
> parser is looking for the "namespace prefix" associated with the
> namespace URI "http://www.w3.org/2001/02/appelv1".
> Post an example document if I'm wrong.

i do have the namespace prefix defined.
an example document is below
<?xml version="1.0" encoding="UTF-8"?>
<appel:RULESET xmlns:p3p="http://www.w3.org/2000/12/p3pv1"

<appel:RULE behavior="block" description="Any marketing must be opt-in with
prompt|Data-Type|Any" prompt="yes" promptmsg="Your privacy agent has
detected a site which will use your data for marketing if you agree to it
- do you want to go to this page">
<p3p:PURPOSE appel:connective="or">
  <p3p:telemarketing required="opt-in"/>
  <p3p:contact required="opt-in"/>

<appel:RULE behavior="block" description="No compulsary marketing"
<p3p:PURPOSE appel:connective="or">
<p3p:telemarketing required="always"/>
<p3p:contact required="always"/>

<appel:RULE behavior="block" description="Blocked because site will use
your information for marketing purposes on an opt-out basis." prompt="no">
<p3p:PURPOSE appel:connective="or">
<p3p:telemarketing required="opt-out"/>
<p3p:contact required="opt-out"/>



> --
> alan kennedy
> ------------------------------------------------------
> email alan:              http://xhaus.com/contact/alan
> --
> http://mail.python.org/mailman/listinfo/python-list

This message was sent using IMP, the Internet Messaging Program.

More information about the XML-SIG mailing list