leptris 1.9.408.0-aarch64-linux → 1.9.410.0-aarch64-linux
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/lib/leptris/version.rb +1 -1
- data/lib/libleptris.so +0 -0
- data/vendor-src/README.md +1 -1
- data/vendor-src/libleptris/CHANGELOG.md +15 -0
- data/vendor-src/libleptris/CMakeLists.txt +1 -1
- data/vendor-src/libleptris/src/leptris/xsd/compile.c +69 -11
- data/vendor-src/libleptris/src/leptris/xsd/content_model.c +43 -10
- data/vendor-src/libleptris/src/leptris/xsd/validate.c +43 -8
- data/vendor-src/libleptris/src/leptris/xsd/xsd_internal.h +8 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/elemZ020-subst-ns/elemZ020.xml +8 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/elemZ020-subst-ns/elemZ020.xsd +19 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/schG2-import-compose/roundtrip_a.xsd +16 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/schG2-import-compose/schG1_c.xsd +17 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/schG2-import-compose/schG2.xml +19 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/schG2-import-compose/schG2_a.xsd +27 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/schG2-import-compose/schG2_b.xsd +15 -0
- data/vendor-src/libleptris/test/xsd/test_i1957_1958.cpp +54 -0
- data/vendor-src/libleptris/test/xsd/test_xsd_compile.cpp +122 -0
- data/vendor-src/libleptris/vcpkg.json +1 -1
- metadata +8 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 734dca53503464d507a6034a40316f40caefd07cf76fb2696180ee5343967fe4
|
|
4
|
+
data.tar.gz: 48ebd6613b1084156ce13baf25a3d792cd8e98e70213797d8529739d047ff99a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c785e7a17974c896a40cabe82255865bed559a059fb8055080626764bb461601e1fd58dc5b1bae3027d1ec40caec8f0c0e6e421900ca531aff1eaa6a1ce9419e
|
|
7
|
+
data.tar.gz: 1612bf5394ba569b6a873cf2bed8784f13456e5377c03113733dc3d7c9a92b3b8d812d1b43aba9b5110c911e91e7e386283a22157e2fd088ca43464cc7bd3835
|
data/Rakefile
CHANGED
|
@@ -8,7 +8,7 @@ RSpec::Core::RakeTask.new(:spec)
|
|
|
8
8
|
# Pin for `rake compile` and the platform-gem builds. Keep in lockstep
|
|
9
9
|
# with .github/workflows/build.yml (which calls `rake compile`) and the
|
|
10
10
|
# CHANGELOG when libleptris releases.
|
|
11
|
-
LIBLEPTRIS_VERSION = "1.9.
|
|
11
|
+
LIBLEPTRIS_VERSION = "1.9.410"
|
|
12
12
|
# Vendored alongside libleptris for fn:normalize-unicode (TODO
|
|
13
13
|
# .restructure/20): built per platform with a RELOCATABLE @rpath
|
|
14
14
|
# install name, loaded by ffi.rb before libleptris so the
|
data/lib/leptris/version.rb
CHANGED
data/lib/libleptris.so
CHANGED
|
Binary file
|
data/vendor-src/README.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [1.9.410] - 2026-11-05
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- **xsd**: a no-namespace element no longer resolves to a same-name **namespaced** global declaration. `xsd_find_element_child_ns`'s no-ns branch carried an ns-blind fallback that typed whole subtrees with a foreign namespace's type — the W3C schG2 shape (lutaml-xsd roundtrip compiles unit A alone; the instance's no-ns `<e1>` answered ns-a's `ct-A` and manufactured two false lexical rows). The fallback is removed; a no-ns element resolves only against true no-ns declarations (leptris#1976, PR #1977; full suite 2239/2239 with no corpus reliance on the fallback). Present since before 1.9.407 — it surfaced in the 1.9.409 wave only because the leptris lane replaced nokogiri as the active validator.
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
## [1.9.409] - 2026-11-05
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- **xsd**: particle typing is NAMESPACE-AWARE — content-model capture records particle namespaces (ref-form resolves the QName; name-form reads @form/elementFormDefault), substitution members ride their own namespace (not the head particle's), and the gates are asymmetric per the pinned corpus posture: qualified particles admit no-ns children leniently, unqualified particles are strict with a fallback when no global declaration could type the child (leptris-rs#46; W3C elemZ020 vendored). Rounds out the v1.9.408 XSD wave (rs#45, #1969, #1964).
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
3
18
|
## [1.9.408] - 2026-11-05
|
|
4
19
|
|
|
5
20
|
### Fixed
|
|
@@ -125,6 +125,9 @@ static XsdAssert* xsd_capture_assert(struct leptris_xsd_schema* s,
|
|
|
125
125
|
LeptrisElement e);
|
|
126
126
|
static XsdCm* xsd_capture_any(LeptrisElement any_child);
|
|
127
127
|
static char* xsd_capture_unit_tns(LeptrisElement e);
|
|
128
|
+
static void xsd_resolve_qname(LeptrisElement e, const char* qname,
|
|
129
|
+
char* uri, size_t urisz, char* local,
|
|
130
|
+
size_t localsz);
|
|
128
131
|
static char* xsd_capture_any_attr_ns(LeptrisElement container);
|
|
129
132
|
static char* xsd_capture_any_attr_ns_deep(
|
|
130
133
|
struct leptris_xsd_schema* s, LeptrisElement container, int depth);
|
|
@@ -272,11 +275,57 @@ static XsdCm* xsd_cm_parse(struct leptris_xsd_schema* s,
|
|
|
272
275
|
} else if (strcmp(local, "element") == 0) {
|
|
273
276
|
cm = xsd_cm_new(XSD_CM_ELEMENT);
|
|
274
277
|
if (cm) {
|
|
275
|
-
const char*
|
|
276
|
-
leptris_element_attribute(e, "
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
278
|
+
const char* ref_raw =
|
|
279
|
+
leptris_element_attribute(e, "ref");
|
|
280
|
+
const char* nm = NULL;
|
|
281
|
+
if (ref_raw) {
|
|
282
|
+
/* elemZ020: record the particle's namespace — a
|
|
283
|
+
* ref binds in the REFERENCED DECLARATION's ns
|
|
284
|
+
* (same-tns ref → tns, cross-ns → the foreign
|
|
285
|
+
* ns). The old capture kept the local name only,
|
|
286
|
+
* so the NFA and the typing DFS matched by name
|
|
287
|
+
* alone. */
|
|
288
|
+
nm = xsd_local_name(ref_raw);
|
|
289
|
+
char ruri[512], rlocal[256];
|
|
290
|
+
xsd_resolve_qname(e, ref_raw, ruri, sizeof(ruri),
|
|
291
|
+
rlocal, sizeof(rlocal));
|
|
292
|
+
if (ruri[0])
|
|
293
|
+
cm->ns = xsd_strdup(ruri);
|
|
294
|
+
else
|
|
295
|
+
cm->ns = xsd_capture_unit_tns(e);
|
|
296
|
+
} else {
|
|
297
|
+
nm = leptris_element_attribute(e, "name");
|
|
298
|
+
/* name-form: @form wins; otherwise the unit's
|
|
299
|
+
* elementFormDefault decides */
|
|
300
|
+
const char* form =
|
|
301
|
+
leptris_element_attribute(e, "form");
|
|
302
|
+
const char* efd = NULL;
|
|
303
|
+
if (!form) {
|
|
304
|
+
for (LeptrisElement up =
|
|
305
|
+
leptris_element_parent(e);
|
|
306
|
+
up; up = leptris_element_parent(up)) {
|
|
307
|
+
const char* ul = NULL;
|
|
308
|
+
leptris_element_expanded_name(
|
|
309
|
+
up, &ul, NULL, NULL);
|
|
310
|
+
if (ul && strcmp(ul, "schema") == 0) {
|
|
311
|
+
efd = leptris_element_attribute(
|
|
312
|
+
up, "elementFormDefault");
|
|
313
|
+
break;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
int qualified =
|
|
318
|
+
form ? strcmp(form, "qualified") == 0
|
|
319
|
+
: (efd &&
|
|
320
|
+
strcmp(efd, "qualified") == 0);
|
|
321
|
+
if (qualified) {
|
|
322
|
+
char* tns = xsd_capture_unit_tns(e);
|
|
323
|
+
if (tns && tns[0])
|
|
324
|
+
cm->ns = tns;
|
|
325
|
+
else
|
|
326
|
+
free(tns);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
280
329
|
cm->name = xsd_strdup(nm);
|
|
281
330
|
const char* pty =
|
|
282
331
|
leptris_element_attribute(e, "type");
|
|
@@ -3379,14 +3428,19 @@ static const XsdElementDecl* xsd_find_element_decl(
|
|
|
3379
3428
|
return NULL;
|
|
3380
3429
|
}
|
|
3381
3430
|
|
|
3382
|
-
|
|
3383
|
-
|
|
3431
|
+
const XsdElementDecl* xsd_substitute_member(
|
|
3432
|
+
struct leptris_xsd_schema* s, const char* name, const char* head) {
|
|
3384
3433
|
const XsdElementDecl* d = xsd_find_element_decl(s, name);
|
|
3385
3434
|
for (int hops = 0; d && d->sub_head && hops < 16; hops++) {
|
|
3386
|
-
if (strcmp(d->sub_head, head) == 0) return
|
|
3435
|
+
if (strcmp(d->sub_head, head) == 0) return d;
|
|
3387
3436
|
d = xsd_find_element_decl(s, d->sub_head);
|
|
3388
3437
|
}
|
|
3389
|
-
return
|
|
3438
|
+
return NULL;
|
|
3439
|
+
}
|
|
3440
|
+
|
|
3441
|
+
int xsd_is_substitute(struct leptris_xsd_schema* s,
|
|
3442
|
+
const char* name, const char* head) {
|
|
3443
|
+
return xsd_substitute_member(s, name, head) != NULL;
|
|
3390
3444
|
}
|
|
3391
3445
|
|
|
3392
3446
|
int xsd_schema_version_11(struct leptris_xsd_schema* s) {
|
|
@@ -3889,8 +3943,12 @@ const XsdElementDecl* xsd_find_element_child_ns(
|
|
|
3889
3943
|
return xsd_ladder_element(s, name, uri, 0);
|
|
3890
3944
|
for (XsdElementDecl* t = s->elements; t; t = t->next)
|
|
3891
3945
|
if (!t->ns && strcmp(t->name, name) == 0) return t;
|
|
3892
|
-
|
|
3893
|
-
|
|
3946
|
+
/* leptris#1976: NO ns-blind fallback for a no-ns child. A
|
|
3947
|
+
* no-namespace element resolves only against true no-ns
|
|
3948
|
+
* declarations — matching a NAMESPACED global of the same name
|
|
3949
|
+
* typed whole subtrees with a foreign type and manufactured
|
|
3950
|
+
* false lexical rows (the schG2 roundtrip shape: a lone ns-a
|
|
3951
|
+
* unit answering the instance's no-ns <e1> with ns-a's ct-A). */
|
|
3894
3952
|
return NULL;
|
|
3895
3953
|
}
|
|
3896
3954
|
|
|
@@ -15,6 +15,13 @@
|
|
|
15
15
|
|
|
16
16
|
#include "xsd_internal.h"
|
|
17
17
|
|
|
18
|
+
/* validate.c-facing global lookup (compile.c): an unqualified
|
|
19
|
+
* particle may leniently admit a namespaced child only when no
|
|
20
|
+
* global declaration in the child's namespace could type it
|
|
21
|
+
* (elemZ020 vs the OOXML-style wp.xsd corpus). */
|
|
22
|
+
extern const struct xsd_element_decl* xsd_find_element_child_ns(
|
|
23
|
+
struct leptris_xsd_schema* s, const char* name, const char* uri);
|
|
24
|
+
|
|
18
25
|
typedef struct {
|
|
19
26
|
int from;
|
|
20
27
|
int symbol; /* -1 = epsilon; else a particle transition */
|
|
@@ -345,8 +352,11 @@ static int all_root_valid(XsdCm* all, const char* target_ns,
|
|
|
345
352
|
size_t hits = 0;
|
|
346
353
|
for (size_t i = 0; i < count; i++) {
|
|
347
354
|
const char* uri = ns_uris ? ns_uris[i] : NULL;
|
|
348
|
-
|
|
349
|
-
|
|
355
|
+
int child_qualified = uri && uri[0];
|
|
356
|
+
int ns_ok = p->ns ? (!child_qualified ||
|
|
357
|
+
strcmp(uri, p->ns) == 0)
|
|
358
|
+
: !child_qualified;
|
|
359
|
+
if (p->name && strcmp(p->name, names[i]) == 0 && ns_ok)
|
|
350
360
|
hits++;
|
|
351
361
|
}
|
|
352
362
|
if ((long)hits < p->min) return 0;
|
|
@@ -357,8 +367,11 @@ static int all_root_valid(XsdCm* all, const char* target_ns,
|
|
|
357
367
|
int matched = 0;
|
|
358
368
|
const char* uri = ns_uris ? ns_uris[i] : NULL;
|
|
359
369
|
for (XsdCm* p = all->first_child; p && !matched; p = p->next) {
|
|
360
|
-
|
|
361
|
-
|
|
370
|
+
int child_qualified2 = uri && uri[0];
|
|
371
|
+
int ns_ok2 = p->ns ? (!child_qualified2 ||
|
|
372
|
+
strcmp(uri, p->ns) == 0)
|
|
373
|
+
: !child_qualified2;
|
|
374
|
+
if (p->name && strcmp(p->name, names[i]) == 0 && ns_ok2)
|
|
362
375
|
matched = 1;
|
|
363
376
|
}
|
|
364
377
|
if (!matched) return 0;
|
|
@@ -408,12 +421,32 @@ int xsd_content_valid(struct leptris_xsd_schema* s, XsdCm* model,
|
|
|
408
421
|
continue;
|
|
409
422
|
XsdCm* p = tr->particle;
|
|
410
423
|
if (p->kind == XSD_CM_ELEMENT) {
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
424
|
+
/* elemZ020: the ns gate is asymmetric — a
|
|
425
|
+
* qualified particle matches its own ns but
|
|
426
|
+
* leniently admits a no-ns child (the pinned
|
|
427
|
+
* #1871 corpus posture); an unqualified
|
|
428
|
+
* particle (ns NULL) is strict: no-ns children
|
|
429
|
+
* only. A substitute hit rides the MEMBER's
|
|
430
|
+
* own ns (cross-ns groups, #1881 sets). */
|
|
431
|
+
const char* pns = p->ns;
|
|
432
|
+
int named = (strcmp(p->name, names[c]) == 0);
|
|
433
|
+
if (!named && n.s) {
|
|
434
|
+
const XsdElementDecl* m =
|
|
435
|
+
xsd_substitute_member(n.s, names[c],
|
|
436
|
+
p->name);
|
|
437
|
+
if (m) {
|
|
438
|
+
named = 1;
|
|
439
|
+
if (m->ns) pns = m->ns;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
int child_ns = uri && uri[0];
|
|
443
|
+
int pns_ok =
|
|
444
|
+
pns ? (!child_ns ||
|
|
445
|
+
(uri && strcmp(uri, pns) == 0))
|
|
446
|
+
: (!child_ns ||
|
|
447
|
+
(n.s && !xsd_find_element_child_ns(
|
|
448
|
+
n.s, names[c], uri)));
|
|
449
|
+
if (named && pns_ok) ss_add(&next, tr->to);
|
|
417
450
|
} else if (p->kind == XSD_CM_ANY) {
|
|
418
451
|
/* #1735: ##targetNamespace/##other are relative
|
|
419
452
|
* to the DECLARING unit's tns */
|
|
@@ -599,6 +599,14 @@ static void validate_children(struct xsd_validator* v,
|
|
|
599
599
|
if (wpc == 2) continue;
|
|
600
600
|
const char* ptype = NULL;
|
|
601
601
|
const char* pfill = NULL;
|
|
602
|
+
/* elemZ020 lenient fallback: an unqualified particle may
|
|
603
|
+
* still type a namespaced child when NO global declaration
|
|
604
|
+
* in the child's namespace could (the OOXML-style wp.xsd
|
|
605
|
+
* corpus: no elementFormDefault, no globals). The strict
|
|
606
|
+
* pass remembers the candidate; the global lookup below
|
|
607
|
+
* decides whether it is needed. */
|
|
608
|
+
const char* ltype = NULL;
|
|
609
|
+
const char* lfill = NULL;
|
|
602
610
|
if (model) {
|
|
603
611
|
XsdCm* stack[64];
|
|
604
612
|
int sp = 0;
|
|
@@ -606,15 +614,34 @@ static void validate_children(struct xsd_validator* v,
|
|
|
606
614
|
while (sp > 0 && ptype == NULL) {
|
|
607
615
|
XsdCm* p = stack[--sp];
|
|
608
616
|
for (; p; p = p->next) {
|
|
617
|
+
int child_ns = cu && cu[0];
|
|
618
|
+
/* asymmetric ns gate (elemZ020 + the pinned
|
|
619
|
+
* #1871 lenient posture): qualified particles
|
|
620
|
+
* match their own ns and leniently admit no-ns
|
|
621
|
+
* children; unqualified particles are strict —
|
|
622
|
+
* no-ns children only, with the lenient
|
|
623
|
+
* fallback when nothing else can type it. */
|
|
624
|
+
int pns_ok =
|
|
625
|
+
p->ns ? (!child_ns ||
|
|
626
|
+
strcmp(p->ns, cu) == 0)
|
|
627
|
+
: !child_ns;
|
|
609
628
|
if (p->kind == XSD_CM_ELEMENT && p->name &&
|
|
610
629
|
strcmp(p->name, cl) == 0 && p->type) {
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
630
|
+
if (pns_ok) {
|
|
631
|
+
ptype = p->type;
|
|
632
|
+
/* leptris-rs#35 (isDefault005): the
|
|
633
|
+
* particle's fixed/default value
|
|
634
|
+
* satisfies EMPTY content (§3.12.2). */
|
|
635
|
+
pfill = p->fixed_value ? p->fixed_value
|
|
636
|
+
: p->default_value;
|
|
637
|
+
break;
|
|
638
|
+
}
|
|
639
|
+
if (!ltype) {
|
|
640
|
+
ltype = p->type;
|
|
641
|
+
lfill = p->fixed_value
|
|
642
|
+
? p->fixed_value
|
|
643
|
+
: p->default_value;
|
|
644
|
+
}
|
|
618
645
|
}
|
|
619
646
|
if (p->kind == XSD_CM_GROUP_REF) {
|
|
620
647
|
XsdGroupDef* g = xsd_find_group(s, p->name);
|
|
@@ -650,7 +677,15 @@ static void validate_children(struct xsd_validator* v,
|
|
|
650
677
|
} else {
|
|
651
678
|
const XsdElementDecl* cd =
|
|
652
679
|
xsd_find_element_child_ns(s, cl, cu);
|
|
653
|
-
if (cd)
|
|
680
|
+
if (cd)
|
|
681
|
+
validate_element_decl(v, s, ce, 0, cd);
|
|
682
|
+
else if (ltype) {
|
|
683
|
+
/* nothing global claims the namespaced child —
|
|
684
|
+
* the unqualified particle's type governs
|
|
685
|
+
* (wp.xsd corpus posture) */
|
|
686
|
+
validate_local(v, s, ce, cl, ltype, lfill,
|
|
687
|
+
ct ? ct->ns : NULL);
|
|
688
|
+
}
|
|
654
689
|
}
|
|
655
690
|
/* wildcard-admitted children without a declaration pass:
|
|
656
691
|
* strict and lax alike admit undeclared names (the pinned
|
|
@@ -211,6 +211,14 @@ typedef struct xsd_element_decl {
|
|
|
211
211
|
int xsd_is_substitute(struct leptris_xsd_schema* s,
|
|
212
212
|
const char* name, const char* head);
|
|
213
213
|
|
|
214
|
+
/* elemZ020: the MEMBER declaration behind a substitute hit — the
|
|
215
|
+
* member carries its OWN namespace (a member in ns g rides a head
|
|
216
|
+
* particle written for ns f, XSD 1.1 cross-ns groups + schema-set
|
|
217
|
+
* compilation), so ns gates must compare against the member's ns,
|
|
218
|
+
* never the head particle's. */
|
|
219
|
+
const XsdElementDecl* xsd_substitute_member(
|
|
220
|
+
struct leptris_xsd_schema* s, const char* name, const char* head);
|
|
221
|
+
|
|
214
222
|
typedef struct xsd_attr_decl {
|
|
215
223
|
char* name; /* attribute local name */
|
|
216
224
|
char* type; /* builtin ref or local simpleType name (NULL=anySimple) */
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<?xml version="1.0"?>
|
|
2
|
+
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
|
3
|
+
elementFormDefault="qualified"
|
|
4
|
+
targetNamespace="foo"
|
|
5
|
+
xmlns="foo"
|
|
6
|
+
>
|
|
7
|
+
<xsd:element name="e1" type="xsd:boolean" />
|
|
8
|
+
<xsd:element name="foo" substitutionGroup="e1" type="xsd:boolean" />
|
|
9
|
+
|
|
10
|
+
<xsd:element name="root" type="B" />
|
|
11
|
+
|
|
12
|
+
<xsd:complexType name="B">
|
|
13
|
+
<xsd:choice maxOccurs="1000">
|
|
14
|
+
<xsd:element ref="e1" />
|
|
15
|
+
<xsd:element name="foo" type="xsd:int" form="unqualified"/>
|
|
16
|
+
</xsd:choice>
|
|
17
|
+
</xsd:complexType>
|
|
18
|
+
|
|
19
|
+
</xsd:schema>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<xsd:schema xmlns="ns-a" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="ns-a">
|
|
2
|
+
<xsd:complexType name="ct-A">
|
|
3
|
+
<xsd:sequence minOccurs="1">
|
|
4
|
+
<xsd:element name="a1" type="xsd:int"/>
|
|
5
|
+
<xsd:element name="a2" type="xsd:boolean"/>
|
|
6
|
+
</xsd:sequence>
|
|
7
|
+
</xsd:complexType>
|
|
8
|
+
<xsd:element name="e1" type="ct-A"/>
|
|
9
|
+
<xsd:element name="root">
|
|
10
|
+
<xsd:complexType>
|
|
11
|
+
<xsd:choice maxOccurs="unbounded">
|
|
12
|
+
<xsd:any namespace="##any" processContents="strict"/>
|
|
13
|
+
</xsd:choice>
|
|
14
|
+
</xsd:complexType>
|
|
15
|
+
</xsd:element>
|
|
16
|
+
</xsd:schema>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
|
2
|
+
targetNamespace="ns-c"
|
|
3
|
+
xmlns="ns-c"
|
|
4
|
+
>
|
|
5
|
+
|
|
6
|
+
<xsd:complexType name="ct-A">
|
|
7
|
+
<xsd:sequence minOccurs="1">
|
|
8
|
+
<xsd:element name="a1" type="xsd:int" />
|
|
9
|
+
<xsd:element name="a2" type="xsd:int" />
|
|
10
|
+
</xsd:sequence>
|
|
11
|
+
</xsd:complexType>
|
|
12
|
+
|
|
13
|
+
<xsd:element name="e1" type="ct-A" />
|
|
14
|
+
|
|
15
|
+
</xsd:schema>
|
|
16
|
+
|
|
17
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<a:root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
2
|
+
xsi:schemaLocation="ns-a schG2_a.xsd"
|
|
3
|
+
xmlns:a="ns-a"
|
|
4
|
+
xmlns:c="ns-c"
|
|
5
|
+
>
|
|
6
|
+
<a:e1>
|
|
7
|
+
<a1>123</a1>
|
|
8
|
+
<a2>true</a2>
|
|
9
|
+
</a:e1>
|
|
10
|
+
<e1>
|
|
11
|
+
<a1>true</a1>
|
|
12
|
+
<a2>123</a2>
|
|
13
|
+
</e1>
|
|
14
|
+
<c:e1>
|
|
15
|
+
<a1>123</a1>
|
|
16
|
+
<a2>123</a2>
|
|
17
|
+
</c:e1>
|
|
18
|
+
|
|
19
|
+
</a:root>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
|
2
|
+
targetNamespace="ns-a"
|
|
3
|
+
xmlns="ns-a"
|
|
4
|
+
>
|
|
5
|
+
|
|
6
|
+
<xsd:import schemaLocation="schG2_b.xsd"/>
|
|
7
|
+
|
|
8
|
+
<xsd:complexType name="ct-A">
|
|
9
|
+
<xsd:sequence minOccurs="1">
|
|
10
|
+
<xsd:element name="a1" type="xsd:int" />
|
|
11
|
+
<xsd:element name="a2" type="xsd:boolean" />
|
|
12
|
+
</xsd:sequence>
|
|
13
|
+
</xsd:complexType>
|
|
14
|
+
|
|
15
|
+
<xsd:element name="e1" type="ct-A" />
|
|
16
|
+
|
|
17
|
+
<xsd:element name="root">
|
|
18
|
+
<xsd:complexType>
|
|
19
|
+
<xsd:choice maxOccurs="unbounded">
|
|
20
|
+
<xsd:any namespace="##any" processContents="strict"/>
|
|
21
|
+
</xsd:choice>
|
|
22
|
+
</xsd:complexType>
|
|
23
|
+
</xsd:element>
|
|
24
|
+
|
|
25
|
+
</xsd:schema>
|
|
26
|
+
|
|
27
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
|
2
|
+
>
|
|
3
|
+
|
|
4
|
+
<xsd:import namespace="ns-c" schemaLocation="schG1_c.xsd" />
|
|
5
|
+
|
|
6
|
+
<xsd:complexType name="ct-A">
|
|
7
|
+
<xsd:sequence minOccurs="1">
|
|
8
|
+
<xsd:element name="a1" type="xsd:boolean" />
|
|
9
|
+
<xsd:element name="a2" type="xsd:int" />
|
|
10
|
+
</xsd:sequence>
|
|
11
|
+
</xsd:complexType>
|
|
12
|
+
|
|
13
|
+
<xsd:element name="e1" type="ct-A" />
|
|
14
|
+
|
|
15
|
+
</xsd:schema>
|
|
@@ -123,3 +123,57 @@ TEST(XsdUnionFixed, NonMemberValueStillRejects) {
|
|
|
123
123
|
leptris_document_free(d);
|
|
124
124
|
leptris_xsd_free(s);
|
|
125
125
|
}
|
|
126
|
+
|
|
127
|
+
// ---- leptris-rs#46 (elemZ020): particle typing is ns-aware ------
|
|
128
|
+
// Real W3C fixture msData/element/elemZ020: a form="unqualified"
|
|
129
|
+
// local particle (xs:int) and a same-name substitution member
|
|
130
|
+
// (xs:boolean) discriminate by namespace. The namespaced child
|
|
131
|
+
// types through its member declaration; the no-ns child types
|
|
132
|
+
// through the unqualified particle.
|
|
133
|
+
|
|
134
|
+
TEST(XsdSubstNs, ElemZ020RealFixtureValidates) {
|
|
135
|
+
EXPECT_EQ(validate_case(cases_path("elemZ020-subst-ns/elemZ020.xsd"),
|
|
136
|
+
cases_path("elemZ020-subst-ns/elemZ020.xml")),
|
|
137
|
+
1);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
TEST(XsdSubstNs, NamespacedChildTypedByMemberNotUnqualifiedParticle) {
|
|
141
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
142
|
+
LeptrisXsdSchema s = leptris_xsd_compile_file(
|
|
143
|
+
cases_path("elemZ020-subst-ns/elemZ020.xsd").c_str(), &st);
|
|
144
|
+
ASSERT_NE(s, (LeptrisXsdSchema)0);
|
|
145
|
+
/* "true" is boolean (the member), not int (the unqualified
|
|
146
|
+
* particle) — the ns-strict member binding types it. */
|
|
147
|
+
const char q[] = "<?xml version=\"1.0\"?>\n"
|
|
148
|
+
"<foo:root xmlns:foo=\"foo\">"
|
|
149
|
+
"<foo:foo>true</foo:foo></foo:root>";
|
|
150
|
+
LeptrisDocument d = leptris_parse_string(q, strlen(q), &st);
|
|
151
|
+
ASSERT_NE(d, nullptr);
|
|
152
|
+
EXPECT_EQ(leptris_xsd_validate(s, d), 1);
|
|
153
|
+
leptris_document_free(d);
|
|
154
|
+
/* int lexical in the member's slot still rejects */
|
|
155
|
+
const char bad[] = "<?xml version=\"1.0\"?>\n"
|
|
156
|
+
"<foo:root xmlns:foo=\"foo\">"
|
|
157
|
+
"<foo:foo>123</foo:foo></foo:root>";
|
|
158
|
+
d = leptris_parse_string(bad, strlen(bad), &st);
|
|
159
|
+
ASSERT_NE(d, nullptr);
|
|
160
|
+
EXPECT_EQ(leptris_xsd_validate(s, d), 0);
|
|
161
|
+
leptris_document_free(d);
|
|
162
|
+
/* the no-ns child rides the form="unqualified" particle */
|
|
163
|
+
const char u[] = "<?xml version=\"1.0\"?>\n"
|
|
164
|
+
"<foo:root xmlns:foo=\"foo\">"
|
|
165
|
+
"<foo>123</foo></foo:root>";
|
|
166
|
+
d = leptris_parse_string(u, strlen(u), &st);
|
|
167
|
+
ASSERT_NE(d, nullptr);
|
|
168
|
+
EXPECT_EQ(leptris_xsd_validate(s, d), 1);
|
|
169
|
+
leptris_document_free(d);
|
|
170
|
+
/* boolean lexical in the unqualified particle's slot rejects */
|
|
171
|
+
const char bad2[] = "<?xml version=\"1.0\"?>\n"
|
|
172
|
+
"<foo:root xmlns:foo=\"foo\">"
|
|
173
|
+
"<foo>true</foo></foo:root>";
|
|
174
|
+
d = leptris_parse_string(bad2, strlen(bad2), &st);
|
|
175
|
+
ASSERT_NE(d, nullptr);
|
|
176
|
+
EXPECT_EQ(leptris_xsd_validate(s, d), 0);
|
|
177
|
+
leptris_document_free(d);
|
|
178
|
+
leptris_xsd_free(s);
|
|
179
|
+
}
|
|
@@ -1256,6 +1256,81 @@ TEST(XsdCompile, StrictAnyAttrGrammarRidesAttributeGroupRefs) {
|
|
|
1256
1256
|
leptris_xsd_free(s);
|
|
1257
1257
|
}
|
|
1258
1258
|
|
|
1259
|
+
// leptris#1976: the 1.9.409 ns-aware particle typing must not
|
|
1260
|
+
// disturb the A(ns)/B(no-ns) import composition — W3C schG2 (valid).
|
|
1261
|
+
// The no-ns global e1 types through B's ct-A (a1:boolean, a2:int);
|
|
1262
|
+
// the ns-a e1 types through A's ct-A (a1:int, a2:boolean).
|
|
1263
|
+
TEST(XsdValidate, SchG2ImportComposeStaysValid) {
|
|
1264
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
1265
|
+
LeptrisXsdSchema s = leptris_xsd_compile_file(
|
|
1266
|
+
LEPTRIS_XSD_CASES_DIR
|
|
1267
|
+
"/schG2-import-compose/schG2_a.xsd", &st);
|
|
1268
|
+
ASSERT_NE(s, (LeptrisXsdSchema)0) << "status " << (int)st;
|
|
1269
|
+
LeptrisDocument d = leptris_parse_file(
|
|
1270
|
+
LEPTRIS_XSD_CASES_DIR
|
|
1271
|
+
"/schG2-import-compose/schG2.xml", &st);
|
|
1272
|
+
ASSERT_NE(d, nullptr) << "status " << (int)st;
|
|
1273
|
+
EXPECT_EQ(leptris_xsd_validate(s, d), 1);
|
|
1274
|
+
for (size_t i = 0; i < leptris_xsd_error_count(s); i++)
|
|
1275
|
+
ADD_FAILURE() << leptris_xsd_error_at(s, i);
|
|
1276
|
+
leptris_document_free(d);
|
|
1277
|
+
leptris_xsd_free(s);
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
// #1976 variant: the same composition through leptris_xsd_compile_set
|
|
1281
|
+
// (the lutaml-xsd EngineContext path) — both unit orders must stay valid.
|
|
1282
|
+
TEST(XsdValidate, SchG2CompileSetBothOrdersValid) {
|
|
1283
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
1284
|
+
const char* paths_ab[] = {
|
|
1285
|
+
LEPTRIS_XSD_CASES_DIR "/schG2-import-compose/schG2_a.xsd",
|
|
1286
|
+
LEPTRIS_XSD_CASES_DIR "/schG2-import-compose/schG2_b.xsd",
|
|
1287
|
+
};
|
|
1288
|
+
const char* paths_ba[] = {
|
|
1289
|
+
LEPTRIS_XSD_CASES_DIR "/schG2-import-compose/schG2_b.xsd",
|
|
1290
|
+
LEPTRIS_XSD_CASES_DIR "/schG2-import-compose/schG2_a.xsd",
|
|
1291
|
+
};
|
|
1292
|
+
const char* doc_paths[] = {
|
|
1293
|
+
LEPTRIS_XSD_CASES_DIR "/schG2-import-compose/schG2.xml",
|
|
1294
|
+
};
|
|
1295
|
+
for (int order = 0; order < 2; order++) {
|
|
1296
|
+
LeptrisXsdSchema s = leptris_xsd_compile_set(
|
|
1297
|
+
order == 0 ? paths_ab : paths_ba, 2, &st);
|
|
1298
|
+
ASSERT_NE(s, (LeptrisXsdSchema)0) << "status " << (int)st;
|
|
1299
|
+
LeptrisDocument d = leptris_parse_file(doc_paths[0], &st);
|
|
1300
|
+
ASSERT_NE(d, nullptr) << "status " << (int)st;
|
|
1301
|
+
EXPECT_EQ(leptris_xsd_validate(s, d), 1) << "order " << order;
|
|
1302
|
+
for (size_t i = 0; i < leptris_xsd_error_count(s); i++)
|
|
1303
|
+
ADD_FAILURE() << "order " << order << ": "
|
|
1304
|
+
<< leptris_xsd_error_at(s, i);
|
|
1305
|
+
leptris_document_free(d);
|
|
1306
|
+
leptris_xsd_free(s);
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1310
|
+
// #1976 root cause face: the lutaml-xsd roundtrip drops the import,
|
|
1311
|
+
// so the engine compiles unit A ALONE (e1/ct-A/root, all ns-a; the
|
|
1312
|
+
// default xmlns="ns-a" preserved). The instance's no-ns <e1> then
|
|
1313
|
+
// meets ONLY ns-a declarations: the strict wildcard reports it
|
|
1314
|
+
// undeclared, and its children a1/a2 typed... by whom? This pins
|
|
1315
|
+
// whatever the engine does here so the fix has a regression gate.
|
|
1316
|
+
TEST(XsdValidate, SchG2RoundtripUnitAAlone) {
|
|
1317
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
1318
|
+
LeptrisXsdSchema s = leptris_xsd_compile_file(
|
|
1319
|
+
LEPTRIS_XSD_CASES_DIR
|
|
1320
|
+
"/schG2-import-compose/roundtrip_a.xsd", &st);
|
|
1321
|
+
ASSERT_NE(s, (LeptrisXsdSchema)0) << "status " << (int)st;
|
|
1322
|
+
LeptrisDocument d = leptris_parse_file(
|
|
1323
|
+
LEPTRIS_XSD_CASES_DIR
|
|
1324
|
+
"/schG2-import-compose/schG2.xml", &st);
|
|
1325
|
+
ASSERT_NE(d, nullptr) << "status " << (int)st;
|
|
1326
|
+
EXPECT_EQ(leptris_xsd_validate(s, d), 1)
|
|
1327
|
+
<< leptris_xsd_error_at(s, 0);
|
|
1328
|
+
for (size_t i = 0; i < leptris_xsd_error_count(s); i++)
|
|
1329
|
+
ADD_FAILURE() << leptris_xsd_error_at(s, i);
|
|
1330
|
+
leptris_document_free(d);
|
|
1331
|
+
leptris_xsd_free(s);
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1259
1334
|
TEST(XsdValidate, ValidDocumentPasses) {
|
|
1260
1335
|
EXPECT_EQ(validate_doc(k_v_schema,
|
|
1261
1336
|
"<rows version=\"2\" status=\"ok\">"
|
|
@@ -1461,6 +1536,53 @@ TEST(XsdDatatypes, TemporalEnumerationComparesByValue) {
|
|
|
1461
1536
|
leptris_xsd_free(s);
|
|
1462
1537
|
}
|
|
1463
1538
|
|
|
1539
|
+
// W3C XSD suite msData/element/elemZ020: particle typing is
|
|
1540
|
+
// NAMESPACE-aware. A form="unqualified" local particle types only
|
|
1541
|
+
// no-namespace children; a namespaced child of the same local name
|
|
1542
|
+
// types through its own (substitution-member) declaration. The
|
|
1543
|
+
// first-name-match DFS bound BOTH to whichever same-name particle
|
|
1544
|
+
// it saw first (elemZ020: 'true' failed xsd:int, '123' failed
|
|
1545
|
+
// xsd:boolean).
|
|
1546
|
+
TEST(XsdValidate, ParticleTypingIsNamespaceAware) {
|
|
1547
|
+
const char* sch =
|
|
1548
|
+
"<xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""
|
|
1549
|
+
" elementFormDefault=\"qualified\" targetNamespace=\"foo\""
|
|
1550
|
+
" xmlns=\"foo\">"
|
|
1551
|
+
"<xsd:element name=\"e1\" type=\"xsd:boolean\"/>"
|
|
1552
|
+
"<xsd:element name=\"foo\" substitutionGroup=\"e1\""
|
|
1553
|
+
" type=\"xsd:boolean\"/>"
|
|
1554
|
+
"<xsd:element name=\"root\" type=\"B\"/>"
|
|
1555
|
+
"<xsd:complexType name=\"B\">"
|
|
1556
|
+
"<xsd:choice maxOccurs=\"1000\">"
|
|
1557
|
+
"<xsd:element ref=\"e1\"/>"
|
|
1558
|
+
"<xsd:element name=\"foo\" type=\"xsd:int\""
|
|
1559
|
+
" form=\"unqualified\"/>"
|
|
1560
|
+
"</xsd:choice></xsd:complexType></xsd:schema>";
|
|
1561
|
+
/* namespaced member: typed by its own boolean declaration */
|
|
1562
|
+
EXPECT_EQ(validate_doc(sch,
|
|
1563
|
+
"<?xml version=\"1.0\"?>\n"
|
|
1564
|
+
"<foo:root xmlns:foo=\"foo\"><foo:foo>true</foo:foo>"
|
|
1565
|
+
"</foo:root>"), 1);
|
|
1566
|
+
/* no-namespace child: typed by the unqualified local particle */
|
|
1567
|
+
EXPECT_EQ(validate_doc(sch,
|
|
1568
|
+
"<?xml version=\"1.0\"?>\n"
|
|
1569
|
+
"<foo:root xmlns:foo=\"foo\"><foo>123</foo></foo:root>"), 1);
|
|
1570
|
+
/* the full suite doc: both shapes interleaved [valid] */
|
|
1571
|
+
EXPECT_EQ(validate_doc(sch,
|
|
1572
|
+
"<?xml version=\"1.0\"?>\n"
|
|
1573
|
+
"<foo:root xmlns:foo=\"foo\"><foo:foo>true</foo:foo>"
|
|
1574
|
+
"<foo>123</foo><foo:foo>true</foo:foo><foo>123</foo>"
|
|
1575
|
+
"</foo:root>"), 1);
|
|
1576
|
+
/* wrong content for each binding still rejects */
|
|
1577
|
+
EXPECT_EQ(validate_doc(sch,
|
|
1578
|
+
"<?xml version=\"1.0\"?>\n"
|
|
1579
|
+
"<foo:root xmlns:foo=\"foo\"><foo:foo>123</foo:foo>"
|
|
1580
|
+
"</foo:root>"), 0);
|
|
1581
|
+
EXPECT_EQ(validate_doc(sch,
|
|
1582
|
+
"<?xml version=\"1.0\"?>\n"
|
|
1583
|
+
"<foo:root xmlns:foo=\"foo\"><foo>true</foo></foo:root>"), 0);
|
|
1584
|
+
}
|
|
1585
|
+
|
|
1464
1586
|
TEST(XsdValidate, ContentModelViolationReports) {
|
|
1465
1587
|
EXPECT_EQ(validate_doc(k_v_schema,
|
|
1466
1588
|
"<rows version=\"1\">"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json",
|
|
3
3
|
"name": "leptris",
|
|
4
|
-
"version": "1.9.
|
|
4
|
+
"version": "1.9.410",
|
|
5
5
|
"description": "High-performance XML parser and XPath 1.0 engine in C (libleptris)",
|
|
6
6
|
"homepage": "https://github.com/leptris/leptris",
|
|
7
7
|
"license": "MIT",
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: leptris
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.9.
|
|
4
|
+
version: 1.9.410.0
|
|
5
5
|
platform: aarch64-linux
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
@@ -1360,6 +1360,8 @@ files:
|
|
|
1360
1360
|
- vendor-src/libleptris/test/xsd/libxml2-cases/dur_0.xsd
|
|
1361
1361
|
- vendor-src/libleptris/test/xsd/libxml2-cases/elem0_0.xml
|
|
1362
1362
|
- vendor-src/libleptris/test/xsd/libxml2-cases/elem0_0.xsd
|
|
1363
|
+
- vendor-src/libleptris/test/xsd/libxml2-cases/elemZ020-subst-ns/elemZ020.xml
|
|
1364
|
+
- vendor-src/libleptris/test/xsd/libxml2-cases/elemZ020-subst-ns/elemZ020.xsd
|
|
1363
1365
|
- vendor-src/libleptris/test/xsd/libxml2-cases/element-err_0.xml
|
|
1364
1366
|
- vendor-src/libleptris/test/xsd/libxml2-cases/element-err_0.xsd
|
|
1365
1367
|
- vendor-src/libleptris/test/xsd/libxml2-cases/element-minmax-err_0.xml
|
|
@@ -1543,6 +1545,11 @@ files:
|
|
|
1543
1545
|
- vendor-src/libleptris/test/xsd/libxml2-cases/scc-no-xmlns_0.xsd
|
|
1544
1546
|
- vendor-src/libleptris/test/xsd/libxml2-cases/scc-no-xsi_0.xml
|
|
1545
1547
|
- vendor-src/libleptris/test/xsd/libxml2-cases/scc-no-xsi_0.xsd
|
|
1548
|
+
- vendor-src/libleptris/test/xsd/libxml2-cases/schG2-import-compose/roundtrip_a.xsd
|
|
1549
|
+
- vendor-src/libleptris/test/xsd/libxml2-cases/schG2-import-compose/schG1_c.xsd
|
|
1550
|
+
- vendor-src/libleptris/test/xsd/libxml2-cases/schG2-import-compose/schG2.xml
|
|
1551
|
+
- vendor-src/libleptris/test/xsd/libxml2-cases/schG2-import-compose/schG2_a.xsd
|
|
1552
|
+
- vendor-src/libleptris/test/xsd/libxml2-cases/schG2-import-compose/schG2_b.xsd
|
|
1546
1553
|
- vendor-src/libleptris/test/xsd/libxml2-cases/schema_set/f.xsd
|
|
1547
1554
|
- vendor-src/libleptris/test/xsd/libxml2-cases/schema_set/g.xsd
|
|
1548
1555
|
- vendor-src/libleptris/test/xsd/libxml2-cases/seq-dubl-elem1_0.xml
|