1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-26 00:37:43 +03:00

Avoid calling xmlSetTreeDoc

Create text nodes with xmlNewDocText or set the document directly to
avoid xmlSetTreeDoc being called when the node is inserted.
This commit is contained in:
Nick Wellnhofer
2022-05-20 23:28:25 +02:00
parent 823bf16156
commit 3e7b4f37aa
9 changed files with 20 additions and 16 deletions

View File

@@ -25,7 +25,7 @@ main(void)
* Create the document.
*/
doc = xmlNewDoc(BAD_CAST "1.0");
n = xmlNewNode(NULL, BAD_CAST "root");
n = xmlNewDocNode(doc, NULL, BAD_CAST "root", NULL);
xmlNodeSetContent(n, BAD_CAST "content");
xmlDocSetRootElement(doc, n);