summaryrefslogtreecommitdiff
path: root/xmlschemas.c
diff options
context:
space:
mode:
authorNick Wellnhofer <wellnhofer@aevum.de>2022-05-20 23:28:25 +0200
committerNick Wellnhofer <wellnhofer@aevum.de>2022-06-20 01:49:39 +0200
commit3e7b4f37aaaf920e6b81e20a3cd33c20420bfa15 (patch)
treeed6c8913b483884ef8173c000d4afffeb6102249 /xmlschemas.c
parent823bf161566da76a27a079d9febe78c4f996004a (diff)
downloadlibxml2-3e7b4f37aaaf920e6b81e20a3cd33c20420bfa15.tar.gz
Avoid calling xmlSetTreeDoc
Create text nodes with xmlNewDocText or set the document directly to avoid xmlSetTreeDoc being called when the node is inserted.
Diffstat (limited to 'xmlschemas.c')
-rw-r--r--xmlschemas.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/xmlschemas.c b/xmlschemas.c
index 7b44bf60..c1c8f4ef 100644
--- a/xmlschemas.c
+++ b/xmlschemas.c
@@ -26467,13 +26467,15 @@ default_psvi:
normValue = xmlSchemaNormalizeValue(inode->typeDef,
inode->decl->value);
if (normValue != NULL) {
- textChild = xmlNewText(BAD_CAST normValue);
+ textChild = xmlNewDocText(inode->node->doc,
+ BAD_CAST normValue);
xmlFree(normValue);
} else
- textChild = xmlNewText(inode->decl->value);
+ textChild = xmlNewDocText(inode->node->doc,
+ inode->decl->value);
if (textChild == NULL) {
VERROR_INT("xmlSchemaValidatorPopElem",
- "calling xmlNewText()");
+ "calling xmlNewDocText()");
goto internal_error;
} else
xmlAddChild(inode->node, textChild);