[xml] Possible bug in the Python bindings for libxml2

        The following simple program fails with libxml2 2.4.28:

import libxml2
#import libxml2mod

def testit():
    doc = libxml2.newDoc('1.0')
    print "Document: %s" % doc
    rootPtr = doc.newDocNode(None, 'document', None)
    print "Root node %s" % rootPtr
#    libxml2mod.xmlDocSetRootElement(doc._o, rootPtr._o)
    doc = rootPtr.docSetRootElement(doc)
    rootPtr.newNsProp(None, 'lang', 'foobar')


        The reason for this failure is that xmlDoc.docSetRootElement()
has an explicit check for a NULL return value from
xmlDocSetRootElement(). AFAICT, NULL should be returned when the
document does not already have any elements.

        The example works as expected if I comment out the call to
docSetRootElement(), and uncomment the lines that are commented out.

Raymond Wiker                        Mail:  Raymond Wiker fast no
Senior Software Engineer             Web:   http://www.fast.no/
Fast Search & Transfer ASA           Phone: +47 23 01 11 60
P.O. Box 1677 Vika                   Fax:   +47 35 54 87 99
NO-0120 Oslo, NORWAY                 Mob:   +47 48 01 11 60

Try FAST Search: http://alltheweb.com/

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]