[xml] A question on xmlUnlinkNode()



Hello all,

With the following code snippet I'm trying to wipe out all
contents of a given xmlNode "cell":

  xmlNode *no;
        
  for (no = cell->children; no; no = no->next) {
    xmlUnlinkNode(no);
  }

  /* The following loop should print nothing. But the
     child nodes are still there! */

  for (no = cell->children; no; no = no->next) {
    fprintf(stderr, "<%s> ", no->name);
  }
  fprintf(stderr, "\n");

  /* and this, of course, makes things go "boom" when
     I later try to save the file */
  xmlFreeNodeList(cell->children);

Why doesn't this work?

Thanks!
--Daniel



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