Re: [xml] xmlUnlinkProp, xmlAddProp



On Wed, Jan 23, 2002 at 12:35:13AM +0100, Petr Kozelka wrote:
Hello Daniel,

attached is the next patch for standalone attribute handling in xmlAdd* functions.
Attention: the diff is against revision 1.181 - the replica at anoncvs.gnome.org seems to be mirrored 
somewhat rarely :-(  - so it
includes my previous patch, too. However theoretically this should not be a problem...

   Applied thanks.
 However I really dislike the use of the x ? y : z construct of the C
language, it makes perfectly obfuscated code. So I replaced

    attr = (elem->ns == NULL) ? xmlHasProp(cur->parent, elem->name) : xmlHasNsProp(cur->parent, elem->name, 
elem->ns->href);

  like expressions with:

    if (elem->ns == NULL)
        attr = xmlHasProp(cur->parent, elem->name);
    else
        attr = xmlHasNsProp(cur->parent, elem->name, elem->ns->href);

 Also the xmlUnlinkNode(cur); added to xmlAddChild() was a problem because
it would remove the link from the document for DTD nodes resulting in
memory leaks (because the node would then not be freed in xmlFreeDoc ).
I removed it until I get a better solution.

Remaining issues:
extending/updating namespace definitions list. I need to make a deeper research for this.

  This is far more complex.

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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