Re: [xml] Why doesn't xmlAddChild unlink the node first?
- From: Daniel Veillard <veillard redhat com>
- To: Bertrand Fritsch <bfr 4js com>
- Cc: xml gnome org
- Subject: Re: [xml] Why doesn't xmlAddChild unlink the node first?
- Date: Thu, 6 Sep 2007 11:36:55 -0400
On Thu, Sep 06, 2007 at 12:16:58PM +0200, Bertrand Fritsch wrote:
Daniel Veillard wrote:
On Wed, Sep 05, 2007 at 12:31:38PM +0200, Bertrand Fritsch wrote:
Hi,
I wonder why the xmlAddChild function doesn't unlink the node before
adding it to the tree, whereas xmlAddNextSibling and xmlAddSibling
functions do it? What is the rationale behind this? From a caller POV,
the difference is compelling since the work to do to call these function
is not the same in one case than in the other.
No rationale, just diverging evolution. If you really care about
this I take patches, but that won't dispense you from doing that
xmlUnlinkNode() to avoid compatibility issues.
Thank you Daniel for your quick answer. For now I'll adapt my code to
unlink the node before calling the xmlAddChild function.
I really think that should be the way apps are implemented. It's bad
to rely on an undocumented side effect when you have the proper calls
to do the same things.
I think the Unkink was added to cope with people who forgot to do the
right thing,
Daniel
--
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard | virtualization library http://libvirt.org/
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]