[XML-SIG] getAttribute??

Dag Sunde dag@orion.no
Mon, 28 May 2001 21:19:24 +0200


Ah!

I got interested in Dom Linu's problem, and was able
to get the attribute with:

>>> atr = elem.attributes['','id'].value

but couldn't for my life understand the first param...
It's the NameSpace! :-)

But why isn't getAttribute('id') working when the NS
is an empty string?

Does getAttribute('id') work if the NS somehow is None?


Dag.

----- Original Message -----
From: "Alexandre Fayolle" <Alexandre.Fayolle@logilab.fr>
To: "Dom Linu" <linudom@hotmail.com>
Cc: <xml-sig@python.org>
Sent: Monday, May 28, 2001 8:51 PM
Subject: Re: [XML-SIG] getAttribute??


> On Mon, 28 May 2001, Dom Linu wrote:
>
> > I have tried this many different ways, but it never seems to work and I
> > always abandon PyXML in favor of something else... so I'll ask here, why
> > does this fail:
> >
> > >>> from xml.dom.ext.reader.Sax2 import FromXml
> > >>> doc = FromXml("<mydoc id='123'>text here</mydoc>")
> > >>> elem = doc.documentElement
> > >>> attr = elem.getAttribute("id")
>
> Try this:
>
> attr = elem.getAttributeNS('','id')
>
> Alexandre Fayolle
> --
> http://www.logilab.com
> Narval is the first software agent available as free software (GPL).
> LOGILAB, Paris (France).
>
>
> _______________________________________________
> XML-SIG maillist  -  XML-SIG@python.org
> http://mail.python.org/mailman/listinfo/xml-sig



**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

Admin
Orion Energy Consulting  AS
**********************************************************************