Re: [xml] xmlCopyNode error
- From: Daniel Veillard <veillard redhat com>
- To: martyn 2 russell bt com
- Cc: xml gnome org
- Subject: Re: [xml] xmlCopyNode error
- Date: Thu, 25 Apr 2002 05:06:04 -0400
On Thu, Apr 25, 2002 at 09:56:07AM +0100, martyn 2 russell bt com wrote:
Ok, I have figured out the dodgy roster problem (genuine mistake on my part
with buf sizes), however three things:
1st: If I use xmlUnlinkNode() and xmlFreeNode() I then have to set the node
(ctxt->myDoc->children) to NULL for the application to continue, else I get
the same xmlCopyNode error I originally reported.
that means the unlinked node originally didn't had a proper parent or doc
field.
2nd: If I use xmlFreeNodeList() instead of xmlFreeNode(), I need NOT set the
node to NULL to keep the application from crashing.
Not sure I can build mentally the full model of what's happening in
your application, not much I analyze from that remark.
3rd: The documentation doesn't state whether the node is set to NULL when
calling xmlFreeNode() or xmlFreeNodeList(), Does it?
What do you mean by "set to NULL" the content pointed by the xmlNodePtr
passed as an *argument* is freed. Whether its content is modified before being
freed must not change your application behaviour otherwise you're using a stale
pointer. And the references to the freed node from you local variables or
outside the document cannot be "magically" cleaned up by the routine, it's
your homework.
In the first case, should I have to set my node to NULL?
Your question doesn't make much sense. The content of the node, no
for the pointers to that area that may be a good programming habbit.
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]