Re: [xml] Python, node.name, scope
- From: Daniel Veillard <veillard redhat com>
- To: Michael Rothwell <rothwell holly-springs nc us>
- Cc: xml gnome org
- Subject: Re: [xml] Python, node.name, scope
- Date: Tue, 25 Feb 2003 04:02:28 -0500
On Mon, Feb 24, 2003 at 03:04:42PM -0500, Michael Rothwell wrote:
In the code snippet below (infinite loop prevention and error checking 
code removed), lines 3 and 4 work properly, and print the node name. 
Line 6, however, yields the following error:
AttributeError: 'NoneType' object has no attribute 'name'
Is this a scope problem? A bug? What am I doing wrong? It seems to me 
that line 6 should work if line 3 does.
1: doc = libxml2.recoverDoc(text)
2: node = doc.children
3: name = node.name
4: print "Node:" + name
5: while 1:
6:   name = node.name
7:   if node.name != 'text': break
  I can't reproduce this. For some reason node became None probably
due to some of the removed code.
Daniel
-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]