mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-01-11 05:17:37 +03:00
xinclude: Don't remove root element
Don't replace include element at root with empty nodeset.
This commit is contained in:
parent
860fb460ea
commit
1dd5e76a69
@ -1 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
|
||||
</doc>
|
||||
|
6
result/XInclude/fallback6.xml.rdr
Normal file
6
result/XInclude/fallback6.xml.rdr
Normal file
@ -0,0 +1,6 @@
|
||||
0 1 doc 0 0
|
||||
1 14 #text 0 1
|
||||
|
||||
1 14 #text 0 1
|
||||
|
||||
0 15 doc 0 0
|
@ -1,6 +1,8 @@
|
||||
<?xml version="1.0"?>
|
||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="b.xml">
|
||||
<xi:fallback><xi:include href="c.xml">
|
||||
<xi:fallback/>
|
||||
</xi:include></xi:fallback>
|
||||
</xi:include>
|
||||
<doc>
|
||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="b.xml">
|
||||
<xi:fallback><xi:include href="c.xml">
|
||||
<xi:fallback/>
|
||||
</xi:include></xi:fallback>
|
||||
</xi:include>
|
||||
</doc>
|
||||
|
13
xinclude.c
13
xinclude.c
@ -1701,10 +1701,15 @@ xmlXIncludeIncludeNode(xmlXIncludeCtxtPtr ctxt, xmlXIncludeRefPtr ref) {
|
||||
nb_elem++;
|
||||
tmp = tmp->next;
|
||||
}
|
||||
if (nb_elem > 1) {
|
||||
xmlXIncludeErr(ctxt, ref->elem, XML_XINCLUDE_MULTIPLE_ROOT,
|
||||
"XInclude error: would result in multiple root nodes\n",
|
||||
NULL);
|
||||
if (nb_elem != 1) {
|
||||
if (nb_elem > 1)
|
||||
xmlXIncludeErr(ctxt, ref->elem, XML_XINCLUDE_MULTIPLE_ROOT,
|
||||
"XInclude error: would result in multiple root "
|
||||
"nodes\n", NULL);
|
||||
else
|
||||
xmlXIncludeErr(ctxt, ref->elem, XML_XINCLUDE_MULTIPLE_ROOT,
|
||||
"XInclude error: would result in no root "
|
||||
"node\n", NULL);
|
||||
xmlFreeNodeList(list);
|
||||
return(-1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user