1From 2fe372a0aa2cdeb5cf518cf430defba36647c502 Mon Sep 17 00:00:00 2001
2From: Damjan Jovanovic <damjan.jov@gmail.com>
3Date: Sat, 21 Aug 2021 07:21:50 +0200
4Subject: [PATCH] Properly fold whitespace around the QName value when
5 validating an XSD schema.
6
7(May also need fixing in other places.)
8
9Issue: 239
10
11Conflict:NA
12Reference:https://gitlab.gnome.org/GNOME/libxml2/-/commit/2fe372a0aa2cdeb5cf518cf430defba36647c502
13
14---
15 xmlschemas.c | 6 +++++-
16 1 file changed, 5 insertions(+), 1 deletion(-)
17
18diff --git a/xmlschemas.c b/xmlschemas.c
19index 2da962b..9da4cd1 100644
20--- a/xmlschemas.c
21+++ b/xmlschemas.c
22@@ -24645,6 +24645,7 @@ xmlSchemaValidateQName(xmlSchemaValidCtxtPtr vctxt,
23 		       int valNeeded)
24 {
25     int ret;
26+    xmlChar *stripped;
27     const xmlChar *nsName;
28     xmlChar *local, *prefix = NULL;
29 
30@@ -24661,7 +24662,10 @@ xmlSchemaValidateQName(xmlSchemaValidCtxtPtr vctxt,
31     * NOTE: xmlSplitQName2 will always return a duplicated
32     * strings.
33     */
34-    local = xmlSplitQName2(value, &prefix);
35+    /* TODO: Export and use xmlSchemaStrip instead */
36+    stripped = xmlSchemaCollapseString(value);
37+    local = xmlSplitQName2(stripped ? stripped : value, &prefix);
38+    xmlFree(stripped);
39     if (local == NULL)
40 	local = xmlStrdup(value);
41     /*
42-- 
432.27.0
44
45