leptris 1.9.409.0 → 1.9.411.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.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +1 -1
  3. data/lib/leptris/vendor/aarch64-linux/libleptris.so +0 -0
  4. data/lib/leptris/vendor/aarch64-linux-musl/libleptris.so +0 -0
  5. data/lib/leptris/vendor/arm-linux/libleptris.so +0 -0
  6. data/lib/leptris/vendor/arm-linux-musl/libleptris.so +0 -0
  7. data/lib/leptris/vendor/arm64-darwin/libleptris.dylib +0 -0
  8. data/lib/leptris/vendor/ppc64le-linux/libleptris.so +0 -0
  9. data/lib/leptris/vendor/s390x-linux-musl/libleptris.so +0 -0
  10. data/lib/leptris/vendor/x86_64-darwin/libleptris.dylib +0 -0
  11. data/lib/leptris/vendor/x86_64-linux/libleptris.so +0 -0
  12. data/lib/leptris/vendor/x86_64-linux-musl/libleptris.so +0 -0
  13. data/lib/leptris/version.rb +1 -1
  14. data/vendor-src/README.md +1 -1
  15. data/vendor-src/libleptris/CHANGELOG.md +21 -0
  16. data/vendor-src/libleptris/CMakeLists.txt +1 -1
  17. data/vendor-src/libleptris/benchmarks/dom/bench_leptris.c +5 -1
  18. data/vendor-src/libleptris/src/leptris/flat/direct_parse.c +85 -4
  19. data/vendor-src/libleptris/src/leptris/xsd/compile.c +6 -2
  20. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs47-regex/Cyrillic.xml +1 -0
  21. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs47-regex/Cyrillic.xsd +8 -0
  22. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs47-regex/reG8.xml +11 -0
  23. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs47-regex/reG8.xsd +29 -0
  24. data/vendor-src/libleptris/test/xsd/libxml2-cases/schG2-import-compose/roundtrip_a.xsd +16 -0
  25. data/vendor-src/libleptris/test/xsd/libxml2-cases/schG2-import-compose/schG1_c.xsd +17 -0
  26. data/vendor-src/libleptris/test/xsd/libxml2-cases/schG2-import-compose/schG2.xml +19 -0
  27. data/vendor-src/libleptris/test/xsd/libxml2-cases/schG2-import-compose/schG2_a.xsd +27 -0
  28. data/vendor-src/libleptris/test/xsd/libxml2-cases/schG2-import-compose/schG2_b.xsd +15 -0
  29. data/vendor-src/libleptris/test/xsd/test_i1957_1958.cpp +16 -0
  30. data/vendor-src/libleptris/test/xsd/test_xsd_compile.cpp +75 -0
  31. data/vendor-src/libleptris/vcpkg.json +1 -1
  32. metadata +11 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 34d9213388bba418d224f6640d254c359b986b575938949697cf4c8017ae3b34
4
- data.tar.gz: e5dffe2cb83ea3aaab4da6d4147ebbce456d3032aa5fab6a2aede0b24237172f
3
+ metadata.gz: 3aad1eca4abc3a03ce96d1dcdfda4bef1b934c9d887046e7e7bd66ec75441a22
4
+ data.tar.gz: 44df630680d4a3de97a41a4aa5a49bf1b39c1654ad47552803a754a7c00dc449
5
5
  SHA512:
6
- metadata.gz: 02b97b55c8250a22cfa04425cd9acb0376d99946734f3128c02ec1ff21af15aef4d979d6420f9bbccf0d9eac89e2a622764b8d7b2953f7e2b75714c2fbc9a7a5
7
- data.tar.gz: 337d18883b91a09d388efe40b65ec153bb38df9303bfe5cfeccacabc7e5b3095582c23c6c33a8d8b8758b114f7bef076231ee5f49ca9b96675eff43f7cd95d2c
6
+ metadata.gz: e40b0fe27fc9a3773fd70aa23522040886ff8c9b93298c37e3ac4049ab64c673a12a137c88c9945780e800ecdea2d72960a61cd5ee10a53180d003414b211019
7
+ data.tar.gz: f60871cc79faadec085e203e1ace8c92a47bbf353bb28f856eab8676edac4b9bf982407f897e1abfe1f817bac98d965a39f2ea51b4ea8405fa6b101c3cc37dff
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.409"
11
+ LIBLEPTRIS_VERSION = "1.9.411"
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Leptris
4
- VERSION = "1.9.409.0"
4
+ VERSION = "1.9.411.0"
5
5
  end
data/vendor-src/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  Sources vendored in this gem (recompile rights; the ruby
2
2
  variant builds them at install via extconf.rb):
3
3
 
4
- - libleptris v1.9.409
4
+ - libleptris v1.9.411
5
5
  - utf8proc v2.11.0
6
6
 
7
7
  Rebuild by hand:
@@ -1,5 +1,26 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.9.411] - 2026-11-06
4
+
5
+ ### Performance
6
+
7
+ - **parse**: the element-open name scan is FUSED with the hash split — `dp_scan_name_fused` produces the extent, the FNV-1a chain, and the last-colon offset in one 4-byte-unrolled walk instead of two passes over the name bytes (#1842 slice 3; line-level-profiled at ~7% of parse on the serialbench shape — attrs 473 / text-scan 405 / wire 219 / name-scan 130 / hash-split 82; ABBA x6 median 1.018x parse, all pairs positive). Hash semantics proven identical to `dp_split_hash_name` and `leptris_name_hash_compute` — parsed and mutated elements keep matching in the child-axis hash lookups.
8
+
9
+ ### Tests
10
+
11
+ - engine-level pins for the leptris-rs#47 faces (reG8 char-range + the Cyrillic `\p{IsCyrillic}` block escape — the sweep showed the regex corpus scoring identically on 1.9.406/407/410 with the engine leading libxml2 1400 vs 1390)
12
+ - the vendored W3C schG2 composition (compile_file + both compile_set unit orders + the roundtrip artifact) riding the #1976 no-ns resolution fix
13
+ - the bench harness gained `LEPTRIS_BENCH_ITERS` for sampling-window profiling
14
+
15
+
16
+
17
+ ## [1.9.410] - 2026-11-05
18
+
19
+ ### Fixed
20
+
21
+ - **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.
22
+
23
+
3
24
  ## [1.9.409] - 2026-11-05
4
25
 
5
26
  ### Fixed
@@ -3,7 +3,7 @@
3
3
  cmake_minimum_required(VERSION 3.20)
4
4
 
5
5
  project(leptris
6
- VERSION 1.9.409
6
+ VERSION 1.9.411
7
7
  DESCRIPTION "Fast XML parser and XPath evaluator in pure C"
8
8
  LANGUAGES C CXX
9
9
  )
@@ -138,7 +138,11 @@ void bench_children_iterator(void* ctx) {
138
138
  }
139
139
 
140
140
  int main(void) {
141
- const size_t ITERATIONS = 1000;
141
+ /* LEPTRIS_BENCH_ITERS: profiling hook — `sample` needs a
142
+ * multi-second window; the default 1000 finishes too fast. */
143
+ const char* iters_env = getenv("LEPTRIS_BENCH_ITERS");
144
+ const size_t ITERATIONS =
145
+ iters_env ? (size_t)strtoul(iters_env, NULL, 10) : 1000;
142
146
 
143
147
  printf("\n");
144
148
  printf("================================================================\n");
@@ -348,6 +348,69 @@ static LEPTRIS_ALWAYS_INLINE void dp_scan_name_p(char** pos) {
348
348
  *pos = s;
349
349
  }
350
350
 
351
+ /* Fused element-open name scan (#1842 slice 3): the extent walk
352
+ * doubles as dp_split_hash_name's FNV-1a hash + last-colon finder,
353
+ * so the name bytes are walked ONCE instead of twice (the profile's
354
+ * name-scan + hash-split cluster, ~7% of parse). Semantics match
355
+ * dp_split_hash_name exactly: h_since restarts at each colon (the
356
+ * split's hash chain), h_all never resets (the hash a colon-bearing
357
+ * name shorter than 3 bytes must keep — the guard would have skipped
358
+ * its colon test), and `colon` is the LAST colon's offset (-1 when
359
+ * none). Returns the scan end. */
360
+ static LEPTRIS_ALWAYS_INLINE char* dp_scan_name_fused(
361
+ char* s, uint16_t* hash_out, ptrdiff_t* colon_out, size_t* len_out) {
362
+ unsigned h_since = 0x811C;
363
+ unsigned h_all = 0x811C;
364
+ ptrdiff_t colon = -1;
365
+ size_t len = 0;
366
+ for (;;) {
367
+ char c = s[0];
368
+ if (DP_UNLIKELY(!IS_NAME_CHAR(c))) break;
369
+ c = s[1];
370
+ if (DP_UNLIKELY(!IS_NAME_CHAR(c))) {
371
+ h_since = ((h_since ^ (unsigned char)s[0]) * 0x0193) & 0xFFFF;
372
+ h_all = ((h_all ^ (unsigned char)s[0]) * 0x0193) & 0xFFFF;
373
+ if (s[0] == ':') { colon = len; h_since = 0x811C; }
374
+ len += 1;
375
+ s += 1;
376
+ break;
377
+ }
378
+ c = s[2];
379
+ if (DP_UNLIKELY(!IS_NAME_CHAR(c))) {
380
+ for (int i = 0; i < 2; i++) {
381
+ h_since = ((h_since ^ (unsigned char)s[i]) * 0x0193) & 0xFFFF;
382
+ h_all = ((h_all ^ (unsigned char)s[i]) * 0x0193) & 0xFFFF;
383
+ if (s[i] == ':') { colon = len; h_since = 0x811C; }
384
+ len += 1;
385
+ }
386
+ s += 2;
387
+ break;
388
+ }
389
+ c = s[3];
390
+ if (DP_UNLIKELY(!IS_NAME_CHAR(c))) {
391
+ for (int i = 0; i < 3; i++) {
392
+ h_since = ((h_since ^ (unsigned char)s[i]) * 0x0193) & 0xFFFF;
393
+ h_all = ((h_all ^ (unsigned char)s[i]) * 0x0193) & 0xFFFF;
394
+ if (s[i] == ':') { colon = len; h_since = 0x811C; }
395
+ len += 1;
396
+ }
397
+ s += 3;
398
+ break;
399
+ }
400
+ for (int i = 0; i < 4; i++) {
401
+ h_since = ((h_since ^ (unsigned char)s[i]) * 0x0193) & 0xFFFF;
402
+ h_all = ((h_all ^ (unsigned char)s[i]) * 0x0193) & 0xFFFF;
403
+ if (s[i] == ':') { colon = len; h_since = 0x811C; }
404
+ len += 1;
405
+ }
406
+ s += 4;
407
+ }
408
+ *hash_out = (uint16_t)((colon >= 0 && len < 3) ? h_all : h_since);
409
+ *colon_out = (colon >= 0 && len >= 3) ? colon : -1;
410
+ *len_out = len;
411
+ return s;
412
+ }
413
+
351
414
  static LEPTRIS_ALWAYS_INLINE void dp_scan_name(DParser* p) {
352
415
  dp_scan_name_p(&p->pos);
353
416
  }
@@ -1993,8 +2056,11 @@ static struct leptris_document* direct_parse_internal(char* buf, size_t len,
1993
2056
  * AFTER dp_parse_attrs returns. */
1994
2057
  p.pos++; /* skip '<' */
1995
2058
  char* name_start = p.pos;
1996
- dp_scan_name(&p);
1997
- size_t name_len = p.pos - name_start;
2059
+ uint16_t name_hash;
2060
+ ptrdiff_t name_colon;
2061
+ size_t name_len;
2062
+ p.pos = dp_scan_name_fused(p.pos, &name_hash, &name_colon,
2063
+ &name_len);
1998
2064
 
1999
2065
  /* Parse attributes (scans from the delimiter position). */
2000
2066
  int self_closing = dp_parse_attrs(&p, elem);
@@ -2010,8 +2076,23 @@ static struct leptris_document* direct_parse_internal(char* buf, size_t len,
2010
2076
  * has finished scanning the open tag. */
2011
2077
  if (dp_nul(&p, name_start + name_len)) goto fail;
2012
2078
 
2013
- if (dp_split_hash_name(&p, elem, name_start, name_len))
2014
- goto fail;
2079
+ /* #1842 slice 3: the hash + colon split point came out
2080
+ * of the fused name scan — the second walk is gone. */
2081
+ elem->name_hash = name_hash;
2082
+ if (name_colon >= 0) {
2083
+ char* colon = name_start + name_colon;
2084
+ *colon = '\0';
2085
+ leptris_elem_set_prefix(elem, name_start, p.pool);
2086
+ elem_set_name(elem, colon + 1);
2087
+ size_t local_len =
2088
+ name_len - (size_t)(colon + 1 - name_start);
2089
+ elem->name_len =
2090
+ (local_len > 254) ? 0xFF : (uint8_t)local_len;
2091
+ } else {
2092
+ elem_set_name(elem, name_start);
2093
+ elem->name_len =
2094
+ (name_len > 254) ? 0xFF : (uint8_t)name_len;
2095
+ }
2015
2096
 
2016
2097
  /* Wire into parent. */
2017
2098
  if (p.depth > 0) {
@@ -3943,8 +3943,12 @@ const XsdElementDecl* xsd_find_element_child_ns(
3943
3943
  return xsd_ladder_element(s, name, uri, 0);
3944
3944
  for (XsdElementDecl* t = s->elements; t; t = t->next)
3945
3945
  if (!t->ns && strcmp(t->name, name) == 0) return t;
3946
- for (XsdElementDecl* t = s->elements; t; t = t->next)
3947
- if (strcmp(t->name, name) == 0) return t;
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). */
3948
3952
  return NULL;
3949
3953
  }
3950
3954
 
@@ -0,0 +1 @@
1
+ <doc xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='Cyrillic.xsd' value='&#x0400;&#x0401;&#x0402;&#x0403;&#x0404;&#x0405;&#x0406;&#x0407;&#x0408;&#x0409;&#x040A;&#x040B;&#x040C;&#x040D;&#x040E;&#x040F;&#x0410;&#x0411;&#x0412;&#x0413;&#x0414;&#x0415;&#x0416;&#x0417;&#x0418;&#x0419;&#x041A;&#x041B;&#x041C;&#x041D;&#x041E;&#x041F;&#x0420;&#x0421;&#x0422;&#x0423;&#x0424;&#x0425;&#x0426;&#x0427;&#x0428;&#x0429;&#x042A;&#x042B;&#x042C;&#x042D;&#x042E;&#x042F;&#x0430;&#x0431;&#x0432;&#x0433;&#x0434;&#x0435;&#x0436;&#x0437;&#x0438;&#x0439;&#x043A;&#x043B;&#x043C;&#x043D;&#x043E;&#x043F;&#x0440;&#x0441;&#x0442;&#x0443;&#x0444;&#x0445;&#x0446;&#x0447;&#x0448;&#x0449;&#x044A;&#x044B;&#x044C;&#x044D;&#x044E;&#x044F;&#x0450;&#x0451;&#x0452;&#x0453;&#x0454;&#x0455;&#x0456;&#x0457;&#x0458;&#x0459;&#x045A;&#x045B;&#x045C;&#x045D;&#x045E;&#x045F;&#x0460;&#x0461;&#x0462;&#x0463;&#x0464;&#x0465;&#x0466;&#x0467;&#x0468;&#x0469;&#x046A;&#x046B;&#x046C;&#x046D;&#x046E;&#x046F;&#x0470;&#x0471;&#x0472;&#x0473;&#x0474;&#x0475;&#x0476;&#x0477;&#x0478;&#x0479;&#x047A;&#x047B;&#x047C;&#x047D;&#x047E;&#x047F;&#x0480;&#x0481;&#x0482;&#x0483;&#x0484;&#x0485;&#x0486;&#x0487;&#x0488;&#x0489;&#x048A;&#x048B;&#x048C;&#x048D;&#x048E;&#x048F;&#x0490;&#x0491;&#x0492;&#x0493;&#x0494;&#x0495;&#x0496;&#x0497;&#x0498;&#x0499;&#x049A;&#x049B;&#x049C;&#x049D;&#x049E;&#x049F;&#x04A0;&#x04A1;&#x04A2;&#x04A3;&#x04A4;&#x04A5;&#x04A6;&#x04A7;&#x04A8;&#x04A9;&#x04AA;&#x04AB;&#x04AC;&#x04AD;&#x04AE;&#x04AF;&#x04B0;&#x04B1;&#x04B2;&#x04B3;&#x04B4;&#x04B5;&#x04B6;&#x04B7;&#x04B8;&#x04B9;&#x04BA;&#x04BB;&#x04BC;&#x04BD;&#x04BE;&#x04BF;&#x04C0;&#x04C1;&#x04C2;&#x04C3;&#x04C4;&#x04C5;&#x04C6;&#x04C7;&#x04C8;&#x04C9;&#x04CA;&#x04CB;&#x04CC;&#x04CD;&#x04CE;&#x04CF;&#x04D0;&#x04D1;&#x04D2;&#x04D3;&#x04D4;&#x04D5;&#x04D6;&#x04D7;&#x04D8;&#x04D9;&#x04DA;&#x04DB;&#x04DC;&#x04DD;&#x04DE;&#x04DF;&#x04E0;&#x04E1;&#x04E2;&#x04E3;&#x04E4;&#x04E5;&#x04E6;&#x04E7;&#x04E8;&#x04E9;&#x04EA;&#x04EB;&#x04EC;&#x04ED;&#x04EE;&#x04EF;&#x04F0;&#x04F1;&#x04F2;&#x04F3;&#x04F4;&#x04F5;&#x04F6;&#x04F7;&#x04F8;&#x04F9;&#x04FA;&#x04FB;&#x04FC;&#x04FD;&#x04FE;&#x04FF;'/>
@@ -0,0 +1,8 @@
1
+ <xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>
2
+ <xs:element name='doc'><xs:complexType><xs:attribute name='value'>
3
+ <xs:simpleType>
4
+ <xs:restriction base='xs:string'>
5
+ <xs:pattern value='\p{IsCyrillic}+'/>
6
+ </xs:restriction>
7
+ </xs:simpleType>
8
+ </xs:attribute></xs:complexType></xs:element></xs:schema>
@@ -0,0 +1,11 @@
1
+ <?xml version="1.0"?>
2
+ <doc xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
3
+ xsi:noNamespaceSchemaLocation='reG8.xsd' >
4
+
5
+ <!--
6
+ base='string', pattern='[0-z]*', value='1234567890:;&lt;=>?@Azaz', type='valid', RULE='12,13,14,17'
7
+ -->
8
+
9
+ <elem att='1234567890:;&lt;=>?@Azaz'/>
10
+
11
+ </doc>
@@ -0,0 +1,29 @@
1
+ <?xml version="1.0"?>
2
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
3
+ >
4
+
5
+ <!--
6
+ base='string', pattern='[0-z]*', value='1234567890:;&lt;=>?@Azaz', type='valid', RULE='12,13,14,17'
7
+ -->
8
+
9
+ <xsd:element name="doc">
10
+ <xsd:complexType>
11
+ <xsd:choice>
12
+ <xsd:element name="elem" type="Regex" minOccurs="1" maxOccurs="unbounded"/>
13
+ </xsd:choice>
14
+ </xsd:complexType>
15
+ </xsd:element>
16
+
17
+ <xsd:complexType name="Regex">
18
+ <xsd:attribute name="att">
19
+ <xsd:simpleType>
20
+ <xsd:restriction base="xsd:string">
21
+ <xsd:pattern value="[0-z]*"/>
22
+ </xsd:restriction>
23
+ </xsd:simpleType>
24
+ </xsd:attribute>
25
+ </xsd:complexType>
26
+
27
+
28
+
29
+ </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>
@@ -177,3 +177,19 @@ TEST(XsdSubstNs, NamespacedChildTypedByMemberNotUnqualifiedParticle) {
177
177
  leptris_document_free(d);
178
178
  leptris_xsd_free(s);
179
179
  }
180
+
181
+ // ---- leptris-rs#47: the 1.9.407 regex-wave regression claim -------
182
+ // reG8: char-range [0-z]* over ASCII punctuation; Cyrillic: the
183
+ // \p{IsCyrillic} block escape over block members. Both expected VALID.
184
+
185
+ TEST(XsdRegexRs47, ReG8CharRangeStaysValid) {
186
+ EXPECT_EQ(validate_case(cases_path("rs47-regex/reG8.xsd"),
187
+ cases_path("rs47-regex/reG8.xml")), 1);
188
+ }
189
+
190
+ TEST(XsdRegexRs47, CyrillicBlockEscapeStaysValid) {
191
+ EXPECT_EQ(validate_case(cases_path("rs47-regex/Cyrillic.xsd"),
192
+ cases_path("rs47-regex/Cyrillic.xml")), 1);
193
+ }
194
+
195
+
@@ -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\">"
@@ -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.409",
4
+ "version": "1.9.411",
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,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leptris
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.409.0
4
+ version: 1.9.411.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-11-05 00:00:00.000000000 Z
11
+ date: 2026-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -1558,10 +1558,19 @@ files:
1558
1558
  - vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/stZ072.xsd
1559
1559
  - vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/test95960_1.xml
1560
1560
  - vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/test95960_1.xsd
1561
+ - vendor-src/libleptris/test/xsd/libxml2-cases/rs47-regex/Cyrillic.xml
1562
+ - vendor-src/libleptris/test/xsd/libxml2-cases/rs47-regex/Cyrillic.xsd
1563
+ - vendor-src/libleptris/test/xsd/libxml2-cases/rs47-regex/reG8.xml
1564
+ - vendor-src/libleptris/test/xsd/libxml2-cases/rs47-regex/reG8.xsd
1561
1565
  - vendor-src/libleptris/test/xsd/libxml2-cases/scc-no-xmlns_0.xml
1562
1566
  - vendor-src/libleptris/test/xsd/libxml2-cases/scc-no-xmlns_0.xsd
1563
1567
  - vendor-src/libleptris/test/xsd/libxml2-cases/scc-no-xsi_0.xml
1564
1568
  - vendor-src/libleptris/test/xsd/libxml2-cases/scc-no-xsi_0.xsd
1569
+ - vendor-src/libleptris/test/xsd/libxml2-cases/schG2-import-compose/roundtrip_a.xsd
1570
+ - vendor-src/libleptris/test/xsd/libxml2-cases/schG2-import-compose/schG1_c.xsd
1571
+ - vendor-src/libleptris/test/xsd/libxml2-cases/schG2-import-compose/schG2.xml
1572
+ - vendor-src/libleptris/test/xsd/libxml2-cases/schG2-import-compose/schG2_a.xsd
1573
+ - vendor-src/libleptris/test/xsd/libxml2-cases/schG2-import-compose/schG2_b.xsd
1565
1574
  - vendor-src/libleptris/test/xsd/libxml2-cases/schema_set/f.xsd
1566
1575
  - vendor-src/libleptris/test/xsd/libxml2-cases/schema_set/g.xsd
1567
1576
  - vendor-src/libleptris/test/xsd/libxml2-cases/seq-dubl-elem1_0.xml