Bjorn Reese wrote:
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 isset 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.
to update it manually:root = xmlDocGetRootElement(doc);
tmp = xmlAddPrevSibling(root, comment);
if(doc->children == root) {
doc->children = tmp;
}
Aleksey