While we're on the subject of libxml2, there is a small problem with the way we use xmlAddChild. msxml doesn't automatically coalesce text nodes when two are next to each other in the tree and keeps them as two separate entities (you call normalize to coalesce them). libxml2 does this automatically when doing xmlAddChild.