1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-12-24 21:33:51 +03:00

xinclude: Always allow XPtr expressions in external documents

This commit is contained in:
Nick Wellnhofer 2022-10-30 20:28:20 +01:00
parent f14529baf5
commit b456e3bb42
11 changed files with 85 additions and 3 deletions

View File

@ -0,0 +1,17 @@
0 1 test 0 0
1 14 #text 0 1
1 1 t1 0 0
2 3 #text 0 1
start
2 3 #text 0 1
start
2 3 #text 0 1
end
1 15 t1 0 0
1 14 #text 0 1
0 15 test 0 0

View File

@ -0,0 +1,18 @@
0 1 x 0 0
1 14 #text 0 1
1 8 #comment 0 1 Simple test of including a set of nodes from an XML document
1 14 #text 0 1
1 1 p 0 0
2 3 #text 0 1 something
1 15 p 0 0
1 1 p 0 0
2 3 #text 0 1 really
1 15 p 0 0
1 1 p 0 0
2 3 #text 0 1 simple
1 15 p 0 0
1 14 #text 0 1
0 15 x 0 0

View File

@ -0,0 +1,18 @@
0 1 x 0 0
1 14 #text 0 1
1 8 #comment 0 1 Simple test of including a set of nodes from an XML document
1 14 #text 0 1
1 1 p 0 0
2 3 #text 0 1 something
1 15 p 0 0
1 1 p 0 0
2 3 #text 0 1 really
1 15 p 0 0
1 1 p 0 0
2 3 #text 0 1 simple
1 15 p 0 0
1 14 #text 0 1
0 15 x 0 0

View File

@ -1 +1 @@
./test/XInclude/without-reader/nodes3.xml:3: element include: XInclude error : Invalid fragment identifier in URI test/XInclude/ents/something.xml#xpointer(//p) use the xpointer attribute
./test/XInclude/docs/nodes3.xml:3: element include: XInclude error : Invalid fragment identifier in URI test/XInclude/ents/something.xml#xpointer(//p) use the xpointer attribute

View File

@ -0,0 +1,26 @@
0 1 book 0 0
1 14 #text 0 1
1 1 chapter 0 0
2 14 #text 0 1
2 1 para 0 0
3 3 #text 0 1 Introduction
2 15 para 0 0
2 14 #text 0 1
1 15 chapter 0 0
1 14 #text 0 1
1 1 chapter 0 0
2 14 #text 0 1
2 1 para 0 0
3 3 #text 0 1 Introduction
2 15 para 0 0
2 14 #text 0 1
1 15 chapter 0 0
1 14 #text 0 1
0 15 book 0 0

View File

@ -603,17 +603,19 @@ xmlXIncludeRecurseDoc(xmlXIncludeCtxtPtr ctxt, xmlDocPtr doc,
const xmlURL url ATTRIBUTE_UNUSED) {
xmlDocPtr oldDoc;
xmlXIncludeRefPtr *oldIncTab;
int oldIncMax, oldIncNr;
int oldIncMax, oldIncNr, oldIsStream;
int i;
oldDoc = ctxt->doc;
oldIncMax = ctxt->incMax;
oldIncNr = ctxt->incNr;
oldIncTab = ctxt->incTab;
oldIsStream = ctxt->isStream;
ctxt->doc = doc;
ctxt->incMax = 0;
ctxt->incNr = 0;
ctxt->incTab = NULL;
ctxt->isStream = 0;
xmlXIncludeDoProcess(ctxt, xmlDocGetRootElement(doc));
@ -627,6 +629,7 @@ xmlXIncludeRecurseDoc(xmlXIncludeCtxtPtr ctxt, xmlDocPtr doc,
ctxt->incMax = oldIncMax;
ctxt->incNr = oldIncNr;
ctxt->incTab = oldIncTab;
ctxt->isStream = oldIsStream;
}
/************************************************************************
@ -1409,7 +1412,7 @@ loaded:
xmlXPathContextPtr xptrctxt;
xmlNodeSetPtr set;
if (ctxt->isStream) {
if (ctxt->isStream && doc == ctxt->doc) {
xmlXIncludeErr(ctxt, ref->elem, XML_XINCLUDE_XPTR_FAILED,
"XPointer expressions not allowed in streaming"
" mode\n", NULL);