Re: [xml] What would make xmlSetProp return null?



* Marco Rogers wrote:
I have two versions of my codebase with pretty minimal changes.  Here's the
call to xmlSetProp

    xmlAttr *elem = xmlSetProp(element->xml_obj,
                                              (const xmlChar*)*name,
                                              (const xmlChar*)*value);

The var element->xml_obj is a xmlNodePtr.

In the old version of the code this produced a valid attribute.  In the new
version it doesn't.  This is part of a non-trivial codebase that is
integrated with google v8 so provided more context is difficult.  I've
checked all of the values and they seem valid.  But elem always ends up
being null.  Any idea where/how I should start to debug?

My guess would be you do not have an element node, but rather some other
node type. A quick look at the source suggests you get NULL in that case
or if the node or the name is NULL, or some rather involved conditions
(see `xmlGetPropNodeInternal`).
-- 
Björn Höhrmann · mailto:bjoern hoehrmann de · http://bjoern.hoehrmann.de
Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de
25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 



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