[4suite] How do I use getAttribute????

Wade Leftwich wade at okaynetwork.com
Mon Feb 12 12:39:28 MST 2001


You can really get yourself confused (or at least I can get myself confused)
like this:

>>> doc = Sax2.Reader().fromStream(StringIO('<foo bar="baz"/>'))
>>> node = doc.getElementsByTagName('foo')[0]
>>> node.setAttribute('bar', 'qux')
>>> ext.Print(node)
<foo bar='baz' bar='qux'/>
>>> newdoc = Sax2.Reader().fromStream(StringIO("<foo bar='baz'
bar='qux'/>"))
Traceback (innermost last):
  File "<interactive input>", line 1, in ?
  File "C:\Python20\_xmlplus\dom\ext\reader\Sax2.py", line 299, in
fromStream
    self.parser.parse(s)
  File "C:\Python20\_xmlplus\sax\expatreader.py", line 43, in parse
    xmlreader.IncrementalParser.parse(self, source)
  File "C:\Python20\_xmlplus\sax\xmlreader.py", line 120, in parse
    self.feed(buffer)
  File "C:\Python20\_xmlplus\sax\expatreader.py", line 92, in feed
    self._err_handler.fatalError(exc)
SystemError: 'finally' pops bad exception



> -----Original Message-----
> From: 4suite-admin at lists.fourthought.com
> [mailto:4suite-admin at lists.fourthought.com]On Behalf Of Jeremy Kloth
> Sent: Monday, February 12, 2001 2:32 PM
> To: Adam Logghe
> Cc: 4suite at lists.fourthought.com
> Subject: Re: [4suite] How do I use getAttribute????
>
>
> > Adam Logghe wrote:
> >
> > Thanks for such a great product. It's actually been very inspiring as
> > I know that there is such a broad range of tools available as I move
> > my projects forward.
> >
> > I am having trouble getting items by name.for both getAttribute and
> > getNamedItem.
> >
>
> Our XML SAX readers use the NS methods for creation of the DOM.  So to
> access any attributes, you would use the get(...)NS methods.  If the
> source document doesn't have prefixes on the attributes, use an empty
> string as the namespaceURI.
>
> testbookbark.getAttributeNS('', 'href')
>
> would return the href attribute value.
>
> --
> Jeremy Kloth                             Consultant
> jeremy.kloth at fourthought.com             (303)583-9900 x 105
> Fourthought, Inc.                        http://www.fourthought.com
> Software-engineering, knowledge-management, XML, CORBA, Linux, Python
> _______________________________________________
> 4suite mailing list
> 4suite at lists.fourthought.com
> http://lists.fourthought.com/mailman/listinfo/4suite
>




More information about the 4suite mailing list