zope xml error

Jinu mail2jinu at yahoo.com
Tue Jul 15 06:08:44 EDT 2003


while i worked with xml in zope using python i got the following error.



Error Type: AttributeError
Error Value: documentElement


i've installed pyxml,xmllib ,xmldocument .

can anyone shed some light

thanks in advance 
Jinu

my python script is as follows

import string
doc=getattr(context,'addressbook.xml')
#doc=context.objectvalues('addressbook.xml')
book=doc.documentElement                    # here the error is generated.
print "Number of items",len(book.childNodes)
names=[]
for item in book.childNodes:
  name=item.firstChild
  names.append(name.firstChild.nodeValue)
print "Names",string.join(names,",")
return printed

addressbook.xml

<?xml version="1.0"?>
<addressbook>
<item>
 <name>Bob </name>
 <address>2118 Wildhare st </address>
</item>
<item>
 <name>Randolf </name>
 <address>13 E. Roundway</address>
</item>
</addressbook>




More information about the Python-list mailing list