leptris 1.9.408.0 → 1.9.409.0
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/vendor/aarch64-linux/libleptris.so +0 -0
- data/lib/leptris/vendor/aarch64-linux-musl/libleptris.so +0 -0
- data/lib/leptris/vendor/arm-linux/libleptris.so +0 -0
- data/lib/leptris/vendor/arm-linux-musl/libleptris.so +0 -0
- data/lib/leptris/vendor/arm64-darwin/libleptris.dylib +0 -0
- data/lib/leptris/vendor/ppc64le-linux/libleptris.so +0 -0
- data/lib/leptris/vendor/s390x-linux-musl/libleptris.so +0 -0
- data/lib/leptris/vendor/x86_64-darwin/libleptris.dylib +0 -0
- data/lib/leptris/vendor/x86_64-linux/libleptris.so +0 -0
- data/lib/leptris/vendor/x86_64-linux-musl/libleptris.so +0 -0
- data/lib/leptris/version.rb +1 -1
- data/vendor-src/README.md +1 -1
- data/vendor-src/libleptris/CHANGELOG.md +8 -0
- data/vendor-src/libleptris/CMakeLists.txt +1 -1
- data/vendor-src/libleptris/src/leptris/xsd/compile.c +63 -9
- 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/test_i1957_1958.cpp +54 -0
- data/vendor-src/libleptris/test/xsd/test_xsd_compile.cpp +47 -0
- data/vendor-src/libleptris/vcpkg.json +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 34d9213388bba418d224f6640d254c359b986b575938949697cf4c8017ae3b34
|
|
4
|
+
data.tar.gz: e5dffe2cb83ea3aaab4da6d4147ebbce456d3032aa5fab6a2aede0b24237172f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 02b97b55c8250a22cfa04425cd9acb0376d99946734f3128c02ec1ff21af15aef4d979d6420f9bbccf0d9eac89e2a622764b8d7b2953f7e2b75714c2fbc9a7a5
|
|
7
|
+
data.tar.gz: 337d18883b91a09d388efe40b65ec153bb38df9303bfe5cfeccacabc7e5b3095582c23c6c33a8d8b8758b114f7bef076231ee5f49ca9b96675eff43f7cd95d2c
|
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.409"
|
|
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
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/lib/leptris/version.rb
CHANGED
data/vendor-src/README.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [1.9.409] - 2026-11-05
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- **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).
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
3
11
|
## [1.9.408] - 2026-11-05
|
|
4
12
|
|
|
5
13
|
### 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) {
|
|
@@ -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>
|
|
@@ -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
|
+
}
|
|
@@ -1461,6 +1461,53 @@ TEST(XsdDatatypes, TemporalEnumerationComparesByValue) {
|
|
|
1461
1461
|
leptris_xsd_free(s);
|
|
1462
1462
|
}
|
|
1463
1463
|
|
|
1464
|
+
// W3C XSD suite msData/element/elemZ020: particle typing is
|
|
1465
|
+
// NAMESPACE-aware. A form="unqualified" local particle types only
|
|
1466
|
+
// no-namespace children; a namespaced child of the same local name
|
|
1467
|
+
// types through its own (substitution-member) declaration. The
|
|
1468
|
+
// first-name-match DFS bound BOTH to whichever same-name particle
|
|
1469
|
+
// it saw first (elemZ020: 'true' failed xsd:int, '123' failed
|
|
1470
|
+
// xsd:boolean).
|
|
1471
|
+
TEST(XsdValidate, ParticleTypingIsNamespaceAware) {
|
|
1472
|
+
const char* sch =
|
|
1473
|
+
"<xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""
|
|
1474
|
+
" elementFormDefault=\"qualified\" targetNamespace=\"foo\""
|
|
1475
|
+
" xmlns=\"foo\">"
|
|
1476
|
+
"<xsd:element name=\"e1\" type=\"xsd:boolean\"/>"
|
|
1477
|
+
"<xsd:element name=\"foo\" substitutionGroup=\"e1\""
|
|
1478
|
+
" type=\"xsd:boolean\"/>"
|
|
1479
|
+
"<xsd:element name=\"root\" type=\"B\"/>"
|
|
1480
|
+
"<xsd:complexType name=\"B\">"
|
|
1481
|
+
"<xsd:choice maxOccurs=\"1000\">"
|
|
1482
|
+
"<xsd:element ref=\"e1\"/>"
|
|
1483
|
+
"<xsd:element name=\"foo\" type=\"xsd:int\""
|
|
1484
|
+
" form=\"unqualified\"/>"
|
|
1485
|
+
"</xsd:choice></xsd:complexType></xsd:schema>";
|
|
1486
|
+
/* namespaced member: typed by its own boolean declaration */
|
|
1487
|
+
EXPECT_EQ(validate_doc(sch,
|
|
1488
|
+
"<?xml version=\"1.0\"?>\n"
|
|
1489
|
+
"<foo:root xmlns:foo=\"foo\"><foo:foo>true</foo:foo>"
|
|
1490
|
+
"</foo:root>"), 1);
|
|
1491
|
+
/* no-namespace child: typed by the unqualified local particle */
|
|
1492
|
+
EXPECT_EQ(validate_doc(sch,
|
|
1493
|
+
"<?xml version=\"1.0\"?>\n"
|
|
1494
|
+
"<foo:root xmlns:foo=\"foo\"><foo>123</foo></foo:root>"), 1);
|
|
1495
|
+
/* the full suite doc: both shapes interleaved [valid] */
|
|
1496
|
+
EXPECT_EQ(validate_doc(sch,
|
|
1497
|
+
"<?xml version=\"1.0\"?>\n"
|
|
1498
|
+
"<foo:root xmlns:foo=\"foo\"><foo:foo>true</foo:foo>"
|
|
1499
|
+
"<foo>123</foo><foo:foo>true</foo:foo><foo>123</foo>"
|
|
1500
|
+
"</foo:root>"), 1);
|
|
1501
|
+
/* wrong content for each binding still rejects */
|
|
1502
|
+
EXPECT_EQ(validate_doc(sch,
|
|
1503
|
+
"<?xml version=\"1.0\"?>\n"
|
|
1504
|
+
"<foo:root xmlns:foo=\"foo\"><foo:foo>123</foo:foo>"
|
|
1505
|
+
"</foo:root>"), 0);
|
|
1506
|
+
EXPECT_EQ(validate_doc(sch,
|
|
1507
|
+
"<?xml version=\"1.0\"?>\n"
|
|
1508
|
+
"<foo:root xmlns:foo=\"foo\"><foo>true</foo></foo:root>"), 0);
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1464
1511
|
TEST(XsdValidate, ContentModelViolationReports) {
|
|
1465
1512
|
EXPECT_EQ(validate_doc(k_v_schema,
|
|
1466
1513
|
"<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.409",
|
|
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.409.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
@@ -1377,6 +1377,8 @@ files:
|
|
|
1377
1377
|
- vendor-src/libleptris/test/xsd/libxml2-cases/dur_0.xsd
|
|
1378
1378
|
- vendor-src/libleptris/test/xsd/libxml2-cases/elem0_0.xml
|
|
1379
1379
|
- vendor-src/libleptris/test/xsd/libxml2-cases/elem0_0.xsd
|
|
1380
|
+
- vendor-src/libleptris/test/xsd/libxml2-cases/elemZ020-subst-ns/elemZ020.xml
|
|
1381
|
+
- vendor-src/libleptris/test/xsd/libxml2-cases/elemZ020-subst-ns/elemZ020.xsd
|
|
1380
1382
|
- vendor-src/libleptris/test/xsd/libxml2-cases/element-err_0.xml
|
|
1381
1383
|
- vendor-src/libleptris/test/xsd/libxml2-cases/element-err_0.xsd
|
|
1382
1384
|
- vendor-src/libleptris/test/xsd/libxml2-cases/element-minmax-err_0.xml
|