zope xml error

Discussion in 'Python' started by Jinu, Jul 15, 2003.

  1. Jinu

    Jinu Guest

    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>
    Jinu, Jul 15, 2003
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. M.-A. Lemburg

    eGenix mxODBC Zope DA for FreeBSD

    M.-A. Lemburg, Jul 1, 2003, in forum: Python
    Replies:
    0
    Views:
    299
    M.-A. Lemburg
    Jul 1, 2003
  2. Florian Konnertz
    Replies:
    1
    Views:
    342
    Ulrich Petri
    Jul 8, 2003
  3. Max M
    Replies:
    6
    Views:
    644
    Lee Harr
    Jul 11, 2003
  4. Shane Hathaway
    Replies:
    2
    Views:
    317
    Michael Hudson
    Aug 29, 2003
  5. Erik Wasser
    Replies:
    5
    Views:
    438
    Peter J. Holzer
    Mar 5, 2006
Loading...

Share This Page