[XML-SIG] minidom parse error - keyerror

Ajay abra9823 at mail.usyd.edu.au
Thu Sep 9 00:34:16 EDT 2004


hi!


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"
xmlns:appel="http://www.w3.org/2001/02/APPELv1">

<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:POLICY>
<p3p:STATEMENT>
<p3p:PURPOSE appel:connective="or">
  <p3p:telemarketing required="opt-in"/>
  <p3p:contact required="opt-in"/>
</p3p:PURPOSE>
</p3p:STATEMENT>
</p3p:POLICY>
</appel:RULE>

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

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

</appel:RULESET>

thanks
cheers



>
> --
> 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 Python-list mailing list