]> git.kaiwu.me - njs.git/commitdiff
XML: fixed tests with libxml2 2.13 and later.
authorDmitry Volyntsev <xeioex@nginx.com>
Thu, 7 Nov 2024 06:08:21 +0000 (22:08 -0800)
committerDmitry Volyntsev <xeioexception@gmail.com>
Thu, 7 Nov 2024 19:04:50 +0000 (11:04 -0800)
This fixes #812 issue on Github.

external/njs_xml_module.c

index 86c896c0e1bd1a32ae736dc8cfc592a4269d8c36..d9f3bbb5fa1ec365f126c90917add00ac59b7186 100644 (file)
@@ -1275,17 +1275,13 @@ njs_xml_node_tags_handler(njs_vm_t *vm, xmlNode *current, njs_str_t *name,
 
     /* set or delete. */
 
-    copy = xmlDocCopyNode(current, current->doc, 1);
+    copy = xmlDocCopyNode(current, current->doc,
+                          2 /* copy properties and namespaces */);
     if (njs_slow_path(copy == NULL)) {
         njs_vm_internal_error(vm, "xmlDocCopyNode() failed");
         return NJS_ERROR;
     }
 
-    if (copy->children != NULL) {
-        xmlFreeNodeList(copy->children);
-        copy->children = NULL;
-    }
-
     if (retval == NULL) {
         /* delete. */
         return njs_xml_replace_node(vm, current, copy);