help - attributes namespace - is this a bug in PyXML
Ajay
abra9823 at mail.usyd.edu.au
Mon Aug 16 12:41:41 EDT 2004
also getAttribute("appel:connective") returns " ", ie it is not None but
when i print it out thats what i get
funnily getAttribute("appel:connective") for an element thats doesn't have
the attribute "appel:connective" still passes the test
if element.getAttribute("appel:connective") != None
so how can i retrieve an attribute of type "appel:connective", ie, prefixed
by the uri appel
Quoting Ajay <abra9823 at mail.usyd.edu.au>:
> hi!
>
> for the XML
> <appel:RULESET xmlns:appel="http://www.w3.org/2001/02/appelv1"
> xmlns:p3p="http://www.w3.org/2000/12/p3pv1">
> <appel:RULE prompt="no">
> <p3p:POLICY>
> <p3p:ACCESS appel:connective="non-and">
> <p3p:all/>
> </p3p:ACCESS>
> </p3p:POLICY>
> </appel:RULE>
>
> if i getupto the "ACCESS" element and print its attribute name and value
> using
> if attribs != None and len(attribs) > 0:
> index = 0
> while index < attribs.length:
> print "attribute ", index, ": ", attribs.item(index).nodeName, "
> has
> value: ", attribs.item(index).nodeValue
> index += 1
>
> it prints ACCESS having the attribute "appel:connective" with the value
> "non-and"
> the statement attribs.getNamedItem("appel:connective") however returns
> None.
> now i think its substituting the namespace for appel but then how would
> you
> access the attribute, just 'connective' doesn't work, 'appel:connective'
> doesn't either and http://www.w3.org/2001/02/appelv1:connective doesn't
> work either.
>
> thanks
>
> cheers
>
>
>
>
>
>
>
>
>
>
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
> --
> 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