Re: [xml] Document comments

Daniel Veillard wrote:

   Hum, I would rather use xmlAddChild(doc, comment) if the root isn't

xmlAddChild() takes an xmlNodePtr, not an xmlDocPtr. If I use root
instead of doc, the comment ends up in the wrong place.

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.

   xmlDocSetRootElement() is more expected to be used for elements nodes
for example it will wipe out the old root if it already exists.

I fail to see the purpose of xmlNewDocComment() then.

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