leptris 1.9.361.1-aarch64-linux → 1.9.362.1-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/README.adoc +21 -0
- 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 +7 -0
- data/vendor-src/libleptris/CMakeLists.txt +1 -1
- data/vendor-src/libleptris/src/leptris/xsd/compile.c +54 -5
- data/vendor-src/libleptris/src/leptris/xsd/content_model.c +5 -1
- data/vendor-src/libleptris/src/leptris/xsd/validate.c +10 -2
- data/vendor-src/libleptris/src/leptris/xsd/xsd_internal.h +7 -0
- data/vendor-src/libleptris/test/xsd/test_xsd_compile.cpp +161 -0
- data/vendor-src/libleptris/vcpkg.json +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '04105926cfd0960392941a093f594a01194329e6e49f221d73497115b0ae9652'
|
|
4
|
+
data.tar.gz: 47c3bdcd81a95aa51352aa7eeb7d9a771ff623b9d8e34b823dc689edd9d05474
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 19e028d14722a7fdb8faccb32c68f158284d54dccf3f291ec851b5dc7214c4dc07185fcefb90aef2575832c55a4e3b6e8c80c4720b1596f6bc9d1417a441dec3
|
|
7
|
+
data.tar.gz: 03cf68de62e693e4391eed16b787bbe4758faae7bafced51b7cb13261e57a61d162db34bd02783fa1d699169c5415c30e7b153d44c4dd2bb575e849f9ba03fea
|
data/README.adoc
CHANGED
|
@@ -17,6 +17,27 @@ The C DOM is the single source of truth — Ruby objects are thin FFI
|
|
|
17
17
|
handles over the C pointers, so every Ruby method maps to one FFI call.
|
|
18
18
|
No tree hydration, no parallel Ruby-side model.
|
|
19
19
|
|
|
20
|
+
== Versioning: {engine-semver}.{binding-patch}
|
|
21
|
+
|
|
22
|
+
Gem versions are **`{libleptris-semver}.{binding-patch}`** — the lockstep
|
|
23
|
+
scheme. The first three components name the EXACT libleptris engine
|
|
24
|
+
release the gem vendors; the fourth is the binding's own patch number
|
|
25
|
+
for that engine.
|
|
26
|
+
|
|
27
|
+
* engine `v1.9.361` + first binding release → `1.9.361.0`
|
|
28
|
+
* binding-only fix on the same engine → `1.9.361.1`
|
|
29
|
+
* engine `v1.9.362` ride → `1.9.362.0`
|
|
30
|
+
|
|
31
|
+
The triple is a contract: `~> 1.9.361` pins both the engine behavior
|
|
32
|
+
and the binding surface. **Never** publish a version whose first three
|
|
33
|
+
components are not an existing engine release, never let the binding
|
|
34
|
+
line run ahead of the engine line, and every engine release must get
|
|
35
|
+
its binding ride (`.0`, or `.1` when the ride itself carries binding
|
|
36
|
+
fixes). Releases go through the release workflow with an explicit
|
|
37
|
+
`next_version` — the workflow owns the bump; version numbers are
|
|
38
|
+
computed from the engine tag being ridden, never from
|
|
39
|
+
"previous gem + 1".
|
|
40
|
+
|
|
20
41
|
== Installation
|
|
21
42
|
|
|
22
43
|
Add to your Gemfile:
|
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.362"
|
|
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,12 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [1.9.362] - 2026-10-16
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- **xsd: per-unit wildcard provenance for `##other` / `##targetNamespace` across imports (#1735, PR #1744).** `xs:any`/`xs:anyAttribute` namespace lists resolve the two unit-relative tokens against the target namespace of the schema unit DECLARING the wildcard, not the merged schema's main tns. Every wildcard now records its declaring unit's tns at capture (`XsdCm.any_unit_tns` for particles; `any_attr_unit_ns` / `any_attr_base_unit_ns` on the type atom for attribute wildcards, threading the #1723 `any_attr_base_ns` precedent across the unit boundary), and `any_ns_matches` / `any_attr_matches` resolve against it with the merged tns as fallback. Red-first gtests pin the element and attribute forms.
|
|
8
|
+
|
|
9
|
+
|
|
3
10
|
## [1.9.361] - 2026-10-15
|
|
4
11
|
|
|
5
12
|
### Fixed
|
|
@@ -96,13 +96,16 @@ static XsdAttrDecl* xsd_copy_attr_rows(const XsdAttrDecl* src);
|
|
|
96
96
|
static void xsd_register_complex(struct leptris_xsd_schema* s,
|
|
97
97
|
XsdCm* root, XsdAttrDecl* attrs,
|
|
98
98
|
const char* name, char* any_attr_ns,
|
|
99
|
-
char*
|
|
99
|
+
char* any_attr_unit_ns,
|
|
100
|
+
char* base_any_attr_ns,
|
|
101
|
+
char* base_any_attr_unit_ns);
|
|
100
102
|
static XsdCm* xsd_capture_complex_model(struct leptris_xsd_schema* s,
|
|
101
103
|
LeptrisElement ct,
|
|
102
104
|
const char* name);
|
|
103
105
|
static XsdAssert* xsd_capture_assert(struct leptris_xsd_schema* s,
|
|
104
106
|
LeptrisElement e);
|
|
105
107
|
static XsdCm* xsd_capture_any(LeptrisElement any_child);
|
|
108
|
+
static char* xsd_capture_unit_tns(LeptrisElement e);
|
|
106
109
|
static char* xsd_capture_any_attr_ns(LeptrisElement container);
|
|
107
110
|
|
|
108
111
|
/* #1626: prefixed QName refs (type="w:CT_Border") resolve by local
|
|
@@ -168,6 +171,7 @@ static void xsd_cm_free(XsdCm* cm) {
|
|
|
168
171
|
free(cm->ns);
|
|
169
172
|
free(cm->ext_base);
|
|
170
173
|
free(cm->any_ns);
|
|
174
|
+
free(cm->any_unit_tns);
|
|
171
175
|
free(cm->text_type);
|
|
172
176
|
free(cm);
|
|
173
177
|
cm = next;
|
|
@@ -270,6 +274,7 @@ static XsdCm* xsd_cm_parse(struct leptris_xsd_schema* s,
|
|
|
270
274
|
if (cm) {
|
|
271
275
|
cm->any_ns = xsd_strdup(
|
|
272
276
|
leptris_element_attribute(e, "namespace"));
|
|
277
|
+
cm->any_unit_tns = xsd_capture_unit_tns(e);
|
|
273
278
|
const char* pc = leptris_element_attribute(
|
|
274
279
|
e, "processContents");
|
|
275
280
|
cm->process_skip =
|
|
@@ -1968,9 +1973,14 @@ static void xsd_resolve_extension_bases(struct leptris_xsd_schema* s) {
|
|
|
1968
1973
|
mine->attrs = prepend;
|
|
1969
1974
|
}
|
|
1970
1975
|
/* the base's attribute wildcard joins the union */
|
|
1971
|
-
if (bt->any_attr_ns && !mine->any_attr_base_ns)
|
|
1976
|
+
if (bt->any_attr_ns && !mine->any_attr_base_ns) {
|
|
1977
|
+
mine->any_attr_base_unit_ns =
|
|
1978
|
+
bt->any_attr_unit_ns
|
|
1979
|
+
? xsd_strdup(bt->any_attr_unit_ns)
|
|
1980
|
+
: NULL;
|
|
1972
1981
|
mine->any_attr_base_ns =
|
|
1973
1982
|
xsd_strdup(bt->any_attr_ns);
|
|
1983
|
+
}
|
|
1974
1984
|
} else if (prepend) {
|
|
1975
1985
|
XsdTypeAttrs* row =
|
|
1976
1986
|
(XsdTypeAttrs*)calloc(1, sizeof(*row));
|
|
@@ -2355,6 +2365,8 @@ LEPTRIS_API void leptris_xsd_free(LeptrisXsdSchema schema) {
|
|
|
2355
2365
|
free(ta->type_name);
|
|
2356
2366
|
free(ta->any_attr_ns);
|
|
2357
2367
|
free(ta->any_attr_base_ns);
|
|
2368
|
+
free(ta->any_attr_unit_ns);
|
|
2369
|
+
free(ta->any_attr_base_unit_ns);
|
|
2358
2370
|
free(ta);
|
|
2359
2371
|
ta = tn;
|
|
2360
2372
|
}
|
|
@@ -2441,6 +2453,7 @@ static XsdCm* xsd_cm_copy_list(const XsdCm* head) {
|
|
|
2441
2453
|
d->type = xsd_strdup(src->type);
|
|
2442
2454
|
d->ns = xsd_strdup(src->ns);
|
|
2443
2455
|
d->any_ns = xsd_strdup(src->any_ns);
|
|
2456
|
+
d->any_unit_tns = xsd_strdup(src->any_unit_tns);
|
|
2444
2457
|
d->process_skip = src->process_skip;
|
|
2445
2458
|
d->min = src->min;
|
|
2446
2459
|
d->max = src->max;
|
|
@@ -2457,7 +2470,9 @@ static XsdCm* xsd_cm_copy_list(const XsdCm* head) {
|
|
|
2457
2470
|
static void xsd_register_complex(struct leptris_xsd_schema* s,
|
|
2458
2471
|
XsdCm* root, XsdAttrDecl* attrs,
|
|
2459
2472
|
const char* name, char* any_attr_ns,
|
|
2460
|
-
char*
|
|
2473
|
+
char* any_attr_unit_ns,
|
|
2474
|
+
char* base_any_attr_ns,
|
|
2475
|
+
char* base_any_attr_unit_ns) {
|
|
2461
2476
|
if (!root) return;
|
|
2462
2477
|
root->name = xsd_strdup(name);
|
|
2463
2478
|
/* leptris-ruby#440: the DECLARING file's targetNamespace — the
|
|
@@ -2475,12 +2490,16 @@ static void xsd_register_complex(struct leptris_xsd_schema* s,
|
|
|
2475
2490
|
ta->attrs = attrs;
|
|
2476
2491
|
ta->any_attr_ns = any_attr_ns;
|
|
2477
2492
|
ta->any_attr_base_ns = base_any_attr_ns;
|
|
2493
|
+
ta->any_attr_unit_ns = any_attr_unit_ns;
|
|
2494
|
+
ta->any_attr_base_unit_ns = base_any_attr_unit_ns;
|
|
2478
2495
|
ta->next = s->type_attrs;
|
|
2479
2496
|
s->type_attrs = ta;
|
|
2480
2497
|
}
|
|
2481
2498
|
} else {
|
|
2482
2499
|
free(any_attr_ns);
|
|
2500
|
+
free(any_attr_unit_ns);
|
|
2483
2501
|
free(base_any_attr_ns);
|
|
2502
|
+
free(base_any_attr_unit_ns);
|
|
2484
2503
|
}
|
|
2485
2504
|
}
|
|
2486
2505
|
|
|
@@ -2520,6 +2539,7 @@ static XsdCm* xsd_capture_any(LeptrisElement any_child) {
|
|
|
2520
2539
|
if (!w) return NULL;
|
|
2521
2540
|
w->any_ns = xsd_strdup(
|
|
2522
2541
|
leptris_element_attribute(any_child, "namespace"));
|
|
2542
|
+
w->any_unit_tns = xsd_capture_unit_tns(any_child);
|
|
2523
2543
|
const char* pc = leptris_element_attribute(any_child,
|
|
2524
2544
|
"processContents");
|
|
2525
2545
|
w->process_skip =
|
|
@@ -2579,7 +2599,9 @@ static XsdCm* xsd_capture_complex_model(struct leptris_xsd_schema* s,
|
|
|
2579
2599
|
if (!root) return NULL;
|
|
2580
2600
|
XsdAttrDecl* attrs = NULL;
|
|
2581
2601
|
char* any_attr_ns = NULL;
|
|
2602
|
+
char* any_attr_unit_ns = NULL;
|
|
2582
2603
|
char* base_any_attr_ns = NULL;
|
|
2604
|
+
char* base_any_attr_unit_ns = NULL;
|
|
2583
2605
|
|
|
2584
2606
|
for (LeptrisNodeRef n =
|
|
2585
2607
|
leptris_node_first_child(leptris_element_as_node(ct));
|
|
@@ -2651,9 +2673,14 @@ static XsdCm* xsd_capture_complex_model(struct leptris_xsd_schema* s,
|
|
|
2651
2673
|
/* the spec's attribute-wildcard union: the
|
|
2652
2674
|
* derived type also allows what the base's
|
|
2653
2675
|
* xs:anyAttribute allowed (#1691) */
|
|
2654
|
-
if (bt && bt->any_attr_ns && !base_any_attr_ns)
|
|
2676
|
+
if (bt && bt->any_attr_ns && !base_any_attr_ns) {
|
|
2677
|
+
base_any_attr_unit_ns =
|
|
2678
|
+
bt->any_attr_unit_ns
|
|
2679
|
+
? xsd_strdup(bt->any_attr_unit_ns)
|
|
2680
|
+
: NULL;
|
|
2655
2681
|
base_any_attr_ns =
|
|
2656
2682
|
xsd_strdup(bt->any_attr_ns);
|
|
2683
|
+
}
|
|
2657
2684
|
}
|
|
2658
2685
|
XsdAttrDecl* own_attrs =
|
|
2659
2686
|
xsd_capture_attr_rows(s, dq, 0);
|
|
@@ -2674,6 +2701,8 @@ static XsdCm* xsd_capture_complex_model(struct leptris_xsd_schema* s,
|
|
|
2674
2701
|
if (s->version_11)
|
|
2675
2702
|
xsd_capture_assert_children(s, dq, root);
|
|
2676
2703
|
if (!any_attr_ns)
|
|
2704
|
+
if (!any_attr_unit_ns)
|
|
2705
|
+
any_attr_unit_ns = xsd_capture_unit_tns(dq);
|
|
2677
2706
|
any_attr_ns = xsd_capture_any_attr_ns(dq);
|
|
2678
2707
|
}
|
|
2679
2708
|
} else if (strcmp(local, "simpleContent") == 0) {
|
|
@@ -2743,6 +2772,8 @@ static XsdCm* xsd_capture_complex_model(struct leptris_xsd_schema* s,
|
|
|
2743
2772
|
* re-capturing would orphan those rows. */
|
|
2744
2773
|
root->first_child = xsd_cm_parse(s, ct, NULL);
|
|
2745
2774
|
if (!attrs) attrs = xsd_capture_attr_rows(s, ct, 0);
|
|
2775
|
+
if (!any_attr_unit_ns)
|
|
2776
|
+
any_attr_unit_ns = xsd_capture_unit_tns(ct);
|
|
2746
2777
|
if (!any_attr_ns) any_attr_ns = xsd_capture_any_attr_ns(ct);
|
|
2747
2778
|
}
|
|
2748
2779
|
/* XSD 1.1: openContent on the type, else the schema default */
|
|
@@ -2812,7 +2843,8 @@ static XsdCm* xsd_capture_complex_model(struct leptris_xsd_schema* s,
|
|
|
2812
2843
|
root->open_any = NULL;
|
|
2813
2844
|
}
|
|
2814
2845
|
xsd_register_complex(s, root, attrs, name, any_attr_ns,
|
|
2815
|
-
base_any_attr_ns
|
|
2846
|
+
any_attr_unit_ns, base_any_attr_ns,
|
|
2847
|
+
base_any_attr_unit_ns);
|
|
2816
2848
|
return root;
|
|
2817
2849
|
}
|
|
2818
2850
|
|
|
@@ -2979,6 +3011,23 @@ static XsdAttrDecl* xsd_capture_attr_rows(struct leptris_xsd_schema* s,
|
|
|
2979
3011
|
}
|
|
2980
3012
|
|
|
2981
3013
|
/* One container's xs:anyAttribute grammar (NULL when absent). */
|
|
3014
|
+
/* #1735: the target namespace of the schema unit containing +e+
|
|
3015
|
+
* (the enclosing xs:schema's @targetNamespace; NULL when absent).
|
|
3016
|
+
* ##targetNamespace/##other in wildcards resolve against THIS, not
|
|
3017
|
+
* the merged schema's main tns — the unit boundary is where
|
|
3018
|
+
* provenance is otherwise lost. */
|
|
3019
|
+
static char* xsd_capture_unit_tns(LeptrisElement e) {
|
|
3020
|
+
for (LeptrisElement up = leptris_element_parent(e); up;
|
|
3021
|
+
up = leptris_element_parent(up)) {
|
|
3022
|
+
const char* local = NULL;
|
|
3023
|
+
leptris_element_expanded_name(up, &local, NULL, NULL);
|
|
3024
|
+
if (local && strcmp(local, "schema") == 0)
|
|
3025
|
+
return xsd_strdup(leptris_element_attribute(up,
|
|
3026
|
+
"targetNamespace"));
|
|
3027
|
+
}
|
|
3028
|
+
return NULL;
|
|
3029
|
+
}
|
|
3030
|
+
|
|
2982
3031
|
static char* xsd_capture_any_attr_ns(LeptrisElement container) {
|
|
2983
3032
|
for (LeptrisNodeRef ac = leptris_node_first_child(
|
|
2984
3033
|
leptris_element_as_node(container));
|
|
@@ -289,7 +289,11 @@ int xsd_content_valid(struct leptris_xsd_schema* s, XsdCm* model,
|
|
|
289
289
|
(!p->ns || (uri && strcmp(uri, p->ns) == 0)))
|
|
290
290
|
ss_add(&next, tr->to);
|
|
291
291
|
} else if (p->kind == XSD_CM_ANY) {
|
|
292
|
-
|
|
292
|
+
/* #1735: ##targetNamespace/##other are relative
|
|
293
|
+
* to the DECLARING unit's tns */
|
|
294
|
+
if (any_ns_matches(p, uri,
|
|
295
|
+
p->any_unit_tns ? p->any_unit_tns
|
|
296
|
+
: target_ns))
|
|
293
297
|
ss_add(&next, tr->to);
|
|
294
298
|
}
|
|
295
299
|
}
|
|
@@ -478,11 +478,19 @@ static void validate_attributes(struct xsd_validator* v,
|
|
|
478
478
|
/* extension union: an attribute is allowed when it matches the
|
|
479
479
|
* derived type's wildcard OR the base type's (the spec's
|
|
480
480
|
* attribute-wildcard union; #1691 anyAttr-derive family) */
|
|
481
|
+
/* #1735: each wildcard resolves against its DECLARING
|
|
482
|
+
* unit's tns (recorded at capture); the merged schema's tns
|
|
483
|
+
* is the fallback */
|
|
481
484
|
if ((ta->any_attr_ns &&
|
|
482
|
-
any_attr_matches(ta->any_attr_ns, auri,
|
|
485
|
+
any_attr_matches(ta->any_attr_ns, auri,
|
|
486
|
+
ta->any_attr_unit_ns
|
|
487
|
+
? ta->any_attr_unit_ns
|
|
488
|
+
: xsd_target_ns(s))) ||
|
|
483
489
|
(ta->any_attr_base_ns &&
|
|
484
490
|
any_attr_matches(ta->any_attr_base_ns, auri,
|
|
485
|
-
|
|
491
|
+
ta->any_attr_base_unit_ns
|
|
492
|
+
? ta->any_attr_base_unit_ns
|
|
493
|
+
: xsd_target_ns(s))))
|
|
486
494
|
continue;
|
|
487
495
|
verrf_at(v, elem, "attribute", local,
|
|
488
496
|
"not declared (strict)");
|
|
@@ -101,6 +101,10 @@ typedef struct xsd_cm {
|
|
|
101
101
|
* capture time (forward ref) — folded by the
|
|
102
102
|
* post-capture resolver (leptris-ruby#440 A) */
|
|
103
103
|
char* any_ns; /* CM_ANY: the namespace attribute grammar */
|
|
104
|
+
/* #1735: the target namespace of the unit DECLARING the
|
|
105
|
+
* wildcard — ##targetNamespace/##other are unit-relative and
|
|
106
|
+
* the merged schema keeps only the main unit's tns */
|
|
107
|
+
char* any_unit_tns;
|
|
104
108
|
int process_skip; /* CM_ANY: processContents="skip" or "lax" */
|
|
105
109
|
int min, max; /* occurrence bounds; max < 0 = unbounded */
|
|
106
110
|
struct xsd_cm* first_child; /* group children list */
|
|
@@ -198,6 +202,9 @@ typedef struct xsd_type_attrs {
|
|
|
198
202
|
char* ns; /* leptris-ruby#440: declaring schema's tns */
|
|
199
203
|
char* any_attr_ns; /* xs:anyAttribute grammar (NULL = absent) */
|
|
200
204
|
char* any_attr_base_ns; /* extension: the base type's wildcard (union) */
|
|
205
|
+
/* #1735: declaring unit's tns for each wildcard above */
|
|
206
|
+
char* any_attr_unit_ns;
|
|
207
|
+
char* any_attr_base_unit_ns;
|
|
201
208
|
XsdAttrDecl* attrs;
|
|
202
209
|
struct xsd_type_attrs* next;
|
|
203
210
|
} XsdTypeAttrs;
|
|
@@ -2173,3 +2173,164 @@ TEST(XsdConformance, ManifestExpectationsMatchOracle) {
|
|
|
2173
2173
|
RecordProperty("pass_invalid", std::to_string(pass_invalid));
|
|
2174
2174
|
RecordProperty("pass_schema_error", std::to_string(pass_schema_error));
|
|
2175
2175
|
}
|
|
2176
|
+
|
|
2177
|
+
// ---- #1735: unit-relative wildcard provenance across imports ----
|
|
2178
|
+
// ##targetNamespace / ##other resolve against the target namespace
|
|
2179
|
+
// of the unit the wildcard is DECLARED in, not the merged schema's
|
|
2180
|
+
// main tns.
|
|
2181
|
+
namespace {
|
|
2182
|
+
|
|
2183
|
+
int validate_compiled(LeptrisXsdSchema s, const char* xml) {
|
|
2184
|
+
LeptrisStatus vst = LEPTRIS_OK;
|
|
2185
|
+
LeptrisDocument d = leptris_parse_string(xml, strlen(xml), &vst);
|
|
2186
|
+
if (!d) return 0;
|
|
2187
|
+
int ok = leptris_xsd_validate(s, d);
|
|
2188
|
+
leptris_document_free(d);
|
|
2189
|
+
return ok;
|
|
2190
|
+
}
|
|
2191
|
+
|
|
2192
|
+
/* imp.xsd carries tns urn:imp and a type whose wildcard uses
|
|
2193
|
+
* ##targetNamespace; main.xsd (tns urn:main) imports it. An
|
|
2194
|
+
* instance child in urn:imp satisfies the wildcard (declaring
|
|
2195
|
+
* unit's tns), one in urn:other never does. */
|
|
2196
|
+
TEST(XsdWildcardUnitTns1735, ElementTargetNamespaceInImportedUnit) {
|
|
2197
|
+
std::string dir = ::testing::TempDir();
|
|
2198
|
+
FILE* f1 = fopen((dir + "x1735imp.xsd").c_str(), "wb");
|
|
2199
|
+
ASSERT_NE(f1, nullptr);
|
|
2200
|
+
const char* imp =
|
|
2201
|
+
"<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\""
|
|
2202
|
+
" targetNamespace=\"urn:imp\">"
|
|
2203
|
+
"<xs:complexType name=\"CT_Open\">"
|
|
2204
|
+
"<xs:sequence>"
|
|
2205
|
+
"<xs:any namespace=\"##targetNamespace\" processContents=\"skip\""
|
|
2206
|
+
" minOccurs=\"0\" maxOccurs=\"unbounded\"/>"
|
|
2207
|
+
"</xs:sequence>"
|
|
2208
|
+
"</xs:complexType>"
|
|
2209
|
+
"</xs:schema>";
|
|
2210
|
+
fwrite(imp, 1, strlen(imp), f1);
|
|
2211
|
+
fclose(f1);
|
|
2212
|
+
FILE* f2 = fopen((dir + "x1735main.xsd").c_str(), "wb");
|
|
2213
|
+
ASSERT_NE(f2, nullptr);
|
|
2214
|
+
const char* mainx =
|
|
2215
|
+
"<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\""
|
|
2216
|
+
" xmlns:i=\"urn:imp\""
|
|
2217
|
+
" targetNamespace=\"urn:main\">"
|
|
2218
|
+
"<xs:import namespace=\"urn:imp\""
|
|
2219
|
+
" schemaLocation=\"x1735imp.xsd\"/>"
|
|
2220
|
+
"<xs:element name=\"r\" type=\"i:CT_Open\"/>"
|
|
2221
|
+
"</xs:schema>";
|
|
2222
|
+
fwrite(mainx, 1, strlen(mainx), f2);
|
|
2223
|
+
fclose(f2);
|
|
2224
|
+
|
|
2225
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
2226
|
+
LeptrisXsdSchema s =
|
|
2227
|
+
leptris_xsd_compile_file((dir + "x1735main.xsd").c_str(), &st);
|
|
2228
|
+
ASSERT_NE(s, (LeptrisXsdSchema)0) << "status " << (int)st;
|
|
2229
|
+
/* child in the IMPORTED unit's tns: the wildcard's
|
|
2230
|
+
* ##targetNamespace is urn:imp (the declaring unit) */
|
|
2231
|
+
EXPECT_EQ(validate_compiled(s, "<r><x xmlns=\"urn:imp\"/></r>"), 1)
|
|
2232
|
+
<< "##targetNamespace must resolve against urn:imp";
|
|
2233
|
+
/* a third namespace matches neither reading */
|
|
2234
|
+
EXPECT_EQ(validate_compiled(s, "<r><x xmlns=\"urn:other\"/></r>"), 0);
|
|
2235
|
+
leptris_xsd_free(s);
|
|
2236
|
+
remove((dir + "x1735imp.xsd").c_str());
|
|
2237
|
+
remove((dir + "x1735main.xsd").c_str());
|
|
2238
|
+
}
|
|
2239
|
+
|
|
2240
|
+
/* ##other in the imported unit excludes the declaring unit's tns
|
|
2241
|
+
* (urn:imp) only — the MAIN unit's tns (urn:main) is "other". */
|
|
2242
|
+
TEST(XsdWildcardUnitTns1735, ElementOtherInImportedUnit) {
|
|
2243
|
+
std::string dir = ::testing::TempDir();
|
|
2244
|
+
FILE* f1 = fopen((dir + "x1735oimp.xsd").c_str(), "wb");
|
|
2245
|
+
ASSERT_NE(f1, nullptr);
|
|
2246
|
+
const char* imp =
|
|
2247
|
+
"<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\""
|
|
2248
|
+
" targetNamespace=\"urn:imp\">"
|
|
2249
|
+
"<xs:complexType name=\"CT_Open\">"
|
|
2250
|
+
"<xs:sequence>"
|
|
2251
|
+
"<xs:any namespace=\"##other\" processContents=\"skip\""
|
|
2252
|
+
" minOccurs=\"0\" maxOccurs=\"unbounded\"/>"
|
|
2253
|
+
"</xs:sequence>"
|
|
2254
|
+
"</xs:complexType>"
|
|
2255
|
+
"</xs:schema>";
|
|
2256
|
+
fwrite(imp, 1, strlen(imp), f1);
|
|
2257
|
+
fclose(f1);
|
|
2258
|
+
FILE* f2 = fopen((dir + "x1735omain.xsd").c_str(), "wb");
|
|
2259
|
+
ASSERT_NE(f2, nullptr);
|
|
2260
|
+
const char* mainx =
|
|
2261
|
+
"<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\""
|
|
2262
|
+
" xmlns:i=\"urn:imp\""
|
|
2263
|
+
" targetNamespace=\"urn:main\">"
|
|
2264
|
+
"<xs:import namespace=\"urn:imp\""
|
|
2265
|
+
" schemaLocation=\"x1735oimp.xsd\"/>"
|
|
2266
|
+
"<xs:element name=\"r\" type=\"i:CT_Open\"/>"
|
|
2267
|
+
"</xs:schema>";
|
|
2268
|
+
fwrite(mainx, 1, strlen(mainx), f2);
|
|
2269
|
+
fclose(f2);
|
|
2270
|
+
|
|
2271
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
2272
|
+
LeptrisXsdSchema s =
|
|
2273
|
+
leptris_xsd_compile_file((dir + "x1735omain.xsd").c_str(), &st);
|
|
2274
|
+
ASSERT_NE(s, (LeptrisXsdSchema)0) << "status " << (int)st;
|
|
2275
|
+
/* the declaring unit's own tns is what ##other excludes */
|
|
2276
|
+
EXPECT_EQ(validate_compiled(s, "<r><x xmlns=\"urn:imp\"/></r>"), 0);
|
|
2277
|
+
/* the main unit's tns is OTHER relative to urn:imp */
|
|
2278
|
+
EXPECT_EQ(validate_compiled(s, "<r><x xmlns=\"urn:main\"/></r>"), 1)
|
|
2279
|
+
<< "##other is relative to urn:imp, not the main tns";
|
|
2280
|
+
leptris_xsd_free(s);
|
|
2281
|
+
remove((dir + "x1735oimp.xsd").c_str());
|
|
2282
|
+
remove((dir + "x1735omain.xsd").c_str());
|
|
2283
|
+
}
|
|
2284
|
+
|
|
2285
|
+
/* attribute wildcards carry the same unit-relative provenance */
|
|
2286
|
+
TEST(XsdWildcardUnitTns1735, AnyAttrTargetNamespaceInImportedUnit) {
|
|
2287
|
+
std::string dir = ::testing::TempDir();
|
|
2288
|
+
FILE* f1 = fopen((dir + "x1735aimp.xsd").c_str(), "wb");
|
|
2289
|
+
ASSERT_NE(f1, nullptr);
|
|
2290
|
+
const char* imp =
|
|
2291
|
+
"<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\""
|
|
2292
|
+
" targetNamespace=\"urn:imp\">"
|
|
2293
|
+
"<xs:complexType name=\"CT_Open\">"
|
|
2294
|
+
"<xs:sequence>"
|
|
2295
|
+
"<xs:element name=\"a\" type=\"xs:token\"/>"
|
|
2296
|
+
"</xs:sequence>"
|
|
2297
|
+
"<xs:anyAttribute namespace=\"##targetNamespace\""
|
|
2298
|
+
" processContents=\"skip\"/>"
|
|
2299
|
+
"</xs:complexType>"
|
|
2300
|
+
"</xs:schema>";
|
|
2301
|
+
fwrite(imp, 1, strlen(imp), f1);
|
|
2302
|
+
fclose(f1);
|
|
2303
|
+
FILE* f2 = fopen((dir + "x1735amain.xsd").c_str(), "wb");
|
|
2304
|
+
ASSERT_NE(f2, nullptr);
|
|
2305
|
+
const char* mainx =
|
|
2306
|
+
"<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\""
|
|
2307
|
+
" xmlns:i=\"urn:imp\""
|
|
2308
|
+
" targetNamespace=\"urn:main\">"
|
|
2309
|
+
"<xs:import namespace=\"urn:imp\""
|
|
2310
|
+
" schemaLocation=\"x1735aimp.xsd\"/>"
|
|
2311
|
+
"<xs:element name=\"r\" type=\"i:CT_Open\"/>"
|
|
2312
|
+
"</xs:schema>";
|
|
2313
|
+
fwrite(mainx, 1, strlen(mainx), f2);
|
|
2314
|
+
fclose(f2);
|
|
2315
|
+
|
|
2316
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
2317
|
+
LeptrisXsdSchema s =
|
|
2318
|
+
leptris_xsd_compile_file((dir + "x1735amain.xsd").c_str(), &st);
|
|
2319
|
+
ASSERT_NE(s, (LeptrisXsdSchema)0) << "status " << (int)st;
|
|
2320
|
+
/* the extra attribute lives in urn:imp = the declaring unit's
|
|
2321
|
+
* ##targetNamespace */
|
|
2322
|
+
EXPECT_EQ(validate_compiled(
|
|
2323
|
+
s, "<r xmlns:x=\"urn:imp\" x:note=\"hi\"><a>x</a></r>"),
|
|
2324
|
+
1)
|
|
2325
|
+
<< "anyAttribute ##targetNamespace must resolve against urn:imp";
|
|
2326
|
+
/* a foreign-namespace attribute never matches */
|
|
2327
|
+
EXPECT_EQ(validate_compiled(
|
|
2328
|
+
s,
|
|
2329
|
+
"<r xmlns:y=\"urn:other\" y:note=\"hi\"><a>x</a></r>"),
|
|
2330
|
+
0);
|
|
2331
|
+
leptris_xsd_free(s);
|
|
2332
|
+
remove((dir + "x1735aimp.xsd").c_str());
|
|
2333
|
+
remove((dir + "x1735amain.xsd").c_str());
|
|
2334
|
+
}
|
|
2335
|
+
|
|
2336
|
+
} // namespace
|
|
@@ -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.362",
|
|
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",
|