[XML-SIG] getAttribute??

Dom Linu linudom@hotmail.com
Mon, 28 May 2001 18:17:50 -0000


<html><DIV>I have tried this many different ways, but it never seems to work and I always abandon PyXML&nbsp;in favor of something else... so I'll ask here, why does this fail:</DIV>
<DIV>&nbsp;</DIV>
<DIV>&gt;&gt;&gt; from xml.dom.ext.reader.Sax2 import FromXml<BR>&gt;&gt;&gt; doc = FromXml("&lt;mydoc id='123'&gt;text here&lt;/mydoc&gt;")<BR>&gt;&gt;&gt; elem = doc.documentElement<BR>&gt;&gt;&gt; attr = elem.getAttribute("id")<BR>&gt;&gt;&gt; print attr</DIV>
<DIV>&nbsp;</DIV>
<DIV>&gt;&gt;&gt; type(attr)<BR>&lt;type 'string'&gt;</DIV>
<DIV>&nbsp;</DIV>
<DIV>I've tried other document, other platforms (both Unix and Win32), and other techniques, but I just can't seem to get an attribute.&nbsp; Any enlightenment would be illuminating.</DIV>
<DIV>&nbsp;</DIV>
<DIV>thx.</DIV>
<DIV>&nbsp;</DIV><br clear=all><hr>Get your FREE download of MSN Explorer at <a href="http://explorer.msn.com">http://explorer.msn.com</a><br></p></html>