Re: [xml] Document comments

Bjorn Reese wrote:

set yet or if the root is already in place use xmlDocGetRootElement()
and xmlAddPrevSibling(root, comment) .

This does not seem to work. The comment does not appear in the output.
As far as I can understand, this does not work because the root element has "parent" equal to NULL and document "children" pointer is not updated. What you can do is
to update it manually:
root = xmlDocGetRootElement(doc);
   tmp = xmlAddPrevSibling(root, comment);
   if(doc->children == root) {
      doc->children = tmp;


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