zope xml error

J

Jinu

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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top