leptris 1.9.403.1-ppc64le-linux → 1.9.404.0-ppc64le-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.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +1 -1
  3. data/lib/leptris/version.rb +1 -1
  4. data/lib/libleptris.so +0 -0
  5. data/vendor-src/README.md +1 -1
  6. data/vendor-src/libleptris/CHANGELOG.md +109 -8
  7. data/vendor-src/libleptris/CMakeLists.txt +1 -1
  8. data/vendor-src/libleptris/src/leptris/descriptor/plan.c +98 -7
  9. data/vendor-src/libleptris/src/leptris/xsd/compile.c +20 -0
  10. data/vendor-src/libleptris/src/leptris/xsd/validate.c +40 -16
  11. data/vendor-src/libleptris/src/leptris/xsd/xsd_internal.h +10 -0
  12. data/vendor-src/libleptris/test/CMakeLists.txt +3 -0
  13. data/vendor-src/libleptris/test/abi/test_descriptor.cpp +232 -0
  14. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_fixed_empty/isdefault005.xml +1 -0
  15. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_fixed_empty/isdefault005.xsd +9 -0
  16. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_list_default/stZ072.xml +1 -0
  17. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_list_default/stZ072.xsd +12 -0
  18. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_mixed_particleless/ctA033.xml +1 -0
  19. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_mixed_particleless/ctA033.xsd +4 -0
  20. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_redefine_ext/idF025.red +8 -0
  21. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_redefine_ext/idF025.xml +15 -0
  22. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_redefine_ext/idF025.xsd +30 -0
  23. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_redefine_ext/idF025_base.xsd +7 -0
  24. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/ctA033.xml +2 -0
  25. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/ctA033.xsd +5 -0
  26. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/ctA035.xml +2 -0
  27. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/ctA035.xsd +5 -0
  28. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idF025.red +8 -0
  29. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idF025.xml +15 -0
  30. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idF025.xsd +30 -0
  31. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idF033.xml +12 -0
  32. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idF033.xsd +23 -0
  33. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idF033a.xsd +8 -0
  34. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idF034.red +8 -0
  35. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idF034.xml +15 -0
  36. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idF034.xsd +30 -0
  37. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idG018.xml +12 -0
  38. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idG018.xsd +23 -0
  39. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idG018a.xsd +8 -0
  40. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idG019.red +8 -0
  41. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idG019.xml +15 -0
  42. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idG019.xsd +30 -0
  43. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idG027.xml +12 -0
  44. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idG027.xsd +23 -0
  45. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idG027a.xsd +8 -0
  46. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idG028.red +8 -0
  47. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idG028.xml +15 -0
  48. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idG028.xsd +30 -0
  49. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/isdefault002.xsd +12 -0
  50. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/isdefault004.xsd +12 -0
  51. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/isdefault005.xml +5 -0
  52. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/isdefault006.xml +5 -0
  53. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/isdefault025.xml +5 -0
  54. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/isdefault026.xml +5 -0
  55. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/stZ072.xml +1 -0
  56. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/stZ072.xsd +20 -0
  57. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/test95960_1.xml +4 -0
  58. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/test95960_1.xsd +12 -0
  59. data/vendor-src/libleptris/test/xsd/test_rs35_regression.cpp +116 -0
  60. data/vendor-src/libleptris/vcpkg.json +1 -1
  61. metadata +47 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 269815b40f880cadd0ad089ef7a5b088626d82c9b8902c279ae038feb34642dd
4
- data.tar.gz: ae22791ef6189e2bdde8b117ce73a6769ab4205f7d44b46fe9c0a566599adee6
3
+ metadata.gz: 4bbd89f850a4875b4a906b37cfb20ff187b0af46d574c04a6589864491a2c278
4
+ data.tar.gz: 1e9150ca721de3abe48b290f1280ed1761cafa0eee20dd2e8683adb0f0605886
5
5
  SHA512:
6
- metadata.gz: 8d1b853f583fedb98b7c82211d72805a8686b9d03162547b22bc0431a33c2c6d57db80fedda4c9cd3e91cf5843c925af9307a164fa3ce0c422c52217ae1adedd
7
- data.tar.gz: 364c64988e6a27ed89c754a116ecadbadb8c9e0307925b60f0e8712ce9c355cdf062cb0909ad6a52ec88fc4ccf26c94cf2a1c1f2786d14f8d4f6fa02644b34a4
6
+ metadata.gz: c5a22c2b5b537ab5a8836b9a7922f4be19db774bfc14a6a2cdd428dc07306ca2960b66845a23a9f914cc0365ce96d7ef1c1f1befd893b2079301fc6508634616
7
+ data.tar.gz: 4e76ce43f4e4a93a19117d4d1d077bbbb88ddfcd2361d6c32ff81ed7774679833aafcec38d473cdaf1838848ea2ccfbe9578d4c605999a48d75c5b216343aa19
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.403"
11
+ LIBLEPTRIS_VERSION = "1.9.404"
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.403.1"
4
+ VERSION = "1.9.404.0"
5
5
  end
data/lib/libleptris.so CHANGED
Binary file
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.403
4
+ - libleptris v1.9.404
5
5
  - utf8proc v2.11.0
6
6
 
7
7
  Rebuild by hand:
@@ -1,17 +1,118 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.9.404] - 2026-11-03
4
+
5
+ ### Fixed
6
+
7
+ - **XSD validation: the leptris-rs#35 regression wave** — four
8
+ strictness defects introduced/exposed by the 1.9.403 fixes, all
9
+ expected-VALID W3C cases that passed on 1.9.402:
10
+ - fixed + empty CHILD elements: particles capture `fixed`/`default`
11
+ and an empty element is satisfied BY the value (XSD 1.0
12
+ §3.12.2/§4.3.1.2) — the fill substitutes for the empty lexical at
13
+ every simple-type check site (isDefault005/006/025/026/060_1);
14
+ - `mixed="true"` on a particle-less complexType admits character
15
+ content (ctA033/ctA035);
16
+ - redefine composition with inline mixed children (idF025/033/034,
17
+ idG018/019/027/028) — the same root cause: the mixed flag now
18
+ survives capture;
19
+ - default-supplied content on an empty list-typed element (stZ072).
20
+ All fifteen issue cases run verbatim from the msData fixtures; the
21
+ capture fields are ASAN-leak clean.
22
+
23
+ - **Descriptor: the ops builder carries the emission namespace
24
+ bindings (leptris#1941)** — `leptris_plan_result_build` dropped the
25
+ `(ns_prefix, ns_uri)` bindings the walk stamps: root, scalar, and
26
+ attribute ops serialized bare names with no xmlns declarations.
27
+ Root ops bind the plan's prefix, scalar ops their row binding,
28
+ nested element ops inherit the CHILD plan's binding (explicit row
29
+ bindings win), and prefix-only rows fall back to the target plan's
30
+ URI. The serializer spells `prefix:local` for attributes from the
31
+ stored LOCAL name. Matching is untouched — the bindings are
32
+ emission-only.
33
+
34
+
35
+
3
36
  ## [1.9.403] - 2026-11-03
4
37
 
5
38
  ### Fixed
6
39
 
7
- - temporal enumeration compares by value, not lexically (leptris-rs#27) (xsd)
8
- - whiteSpace=collapse covers every non-string builtin (leptris-rs#29, elemZ002) (xsd)
9
- - a nilled element must have empty content - the model is not applied (leptris-rs#26) (xsd)
10
- - empty content satisfies a fixed value; -0 lexes for nonNegativeInteger (leptris-rs#25/#28) (xsd)
11
- - subtraction root cause, XSD \w excludes '_', empty content model (leptris#1936 reF39/reZ002/p2) (rng,xsd)
12
- - in-class builtin merge carries uni ranges and XML pins (leptris#1936 reZ003-006) (rng)
13
- - {n,} unbounded, empty branches, and REP over nullable bodies (leptris#1936 reC57/reE10/reD3) (rng)
14
- - regex-tail conformance - pattern disjunction, class grammar, empty content (leptris#1936 p16/reG) (xsd)
40
+ **XSD regex conformance: the #1936 family closes.** The
41
+ msMeta-classified W3C XSD suite divergences go from 104
42
+ engine-wrong rows to ZERO; the 22 remaining sweep divergences are
43
+ documented suite-stale dispositions (reJ x15 modern-Unicode,
44
+ reS/reT `queried` rows, Unicode-3.1 vintage, reDH7a whose suite
45
+ metadata contradicts its own annotation and the oracle).
46
+
47
+ - **Multiple `xs:pattern` facets are a disjunction** (p16: two
48
+ patterns accept a value matching ANY of them, "same as
49
+ `[abc]+|[123]+`") — the old last-pattern-wins capture
50
+ under-accepted every earlier pattern.
51
+ - **Pattern facets are validated at schema compile** (F.1
52
+ productions [14]/[17]-[22]): a standalone `-` is a class member
53
+ only at group start or end — mid-dash patterns
54
+ (`[a-c-1-4x-z-7-9]`, `[a-a-x-x]`, reG26-33/reH19) are grammar
55
+ errors and reject the schema. Empty patterns stay legal (reA1).
56
+ - **In-class negated builtins complement exactly** (reG21/23):
57
+ `[\D]+` matched `'1'` because the uppercase spellings built an
58
+ empty member set and the "complement" memset accepted every
59
+ byte. The positive class now rides the negm slot — exact across
60
+ bytes, uni ranges and categories.
61
+ - **charClassSub skipped only the `-`** before handing the stream
62
+ to the class parser, which expects entry PAST the `[` — the
63
+ subtrahend's `[` parsed as a literal member and a leading `^`
64
+ was dropped, so `[a-z-[^a]]` matched a-z minus `{a}` instead of
65
+ `{a}` (reF39). The subtraction also composes AFTER the
66
+ negCharGroup flip (`[^cde-[ag]]`, RegexTest_430).
67
+ - **`\w` excludes ALL of `\p{P}`** — Pc too: `'_'` is NOT a word
68
+ char (reZ002: `first_last` fails `[\w\-\.]+@.*`; Perl's `\w`
69
+ includes it, XSD's does not).
70
+ - **`{n,}` stays unbounded** (the `{n}`-exact fix collapsed every
71
+ comma form to `{n,n}` — reC57); **an empty branch is legal**
72
+ and matches only the empty string (reE10); **a REP over a
73
+ nullable body** pins each counted iteration to consume
74
+ (reD3-6: `((boy|(girl))...?)|(man|woman)...` under `woman1y`).
75
+ - **The in-class builtin merge carries uni ranges and the XML 1.0
76
+ explicit-list pins** (reZ003-006): U+1369-1371 (legacy Nd) in
77
+ `[\d]`, U+212E (BaseChar) in `\i`/`\c`, U+06DD/U+06DE
78
+ (Mn-in-3.1 demotions) and U+00B7/U+0387 (Extender's explicit Po
79
+ members) in `\c`.
80
+ - **Empty content faces simple-type facets** (reG17: `''` fails
81
+ the pattern and is not a valid `xs:integer`); the fixed-value
82
+ check fires with no text node.
83
+ - **An attributes-only complexType has EMPTY content** —
84
+ character content violates it (p2: `<elem>abc</elem>`
85
+ [invalid]; whitespace-only too, per the oracle).
86
+
87
+ **leptris-rs#25-29 validation-semantics wave** (found by the
88
+ binding audit):
89
+
90
+ - **rs#25 (regression in 1.9.402)**: an element with a fixed
91
+ value and EMPTY instance content is VALID — the fixed value
92
+ supplies the content (XSD §3.12.2; nine W3C rows flipped on the
93
+ 402 ride: isDefault001/002/076, ctZ013a, elemQ019, stE065/066/
94
+ 096, particlesZ040). Only differing non-empty content violates;
95
+ whitespace-only counts as empty.
96
+ - **rs#26**: a NILLED element has neither character nor element
97
+ content — the content model is not applied
98
+ (particlesIa002/QFE1700g2). Attributes are unaffected and still
99
+ validate.
100
+ - **rs#27**: temporal enumeration compares by VALUE, not
101
+ lexically — dateTime by instant (App. E: `+00:00` equals `Z` of
102
+ the same instant), time/date/gMonth normalize only the
103
+ zero-timezone spellings (the timezone is part of the value).
104
+ - **rs#28**: `-0` is a valid nonNegativeInteger lexical (§3.3.20:
105
+ zero may carry a negative sign); positiveInteger keeps
106
+ excluding it.
107
+ - **rs#29**: whiteSpace=collapse is FIXED on every builtin except
108
+ string (preserve) and normalizedString (replace) — the xsi:type
109
+ override path now collapses integer content like the declared
110
+ path (elemZ002).
111
+
112
+ All fixes are red-first in the test suite (158 XSD specs green in
113
+ both the utf8proc and no-utf8proc configs) and verified against
114
+ the vendored W3C corpus documents; rng/sch/dtd/xpath/libxslt
115
+ suites unchanged (204 + 1 standing skip).
15
116
 
16
117
 
17
118
 
@@ -3,7 +3,7 @@
3
3
  cmake_minimum_required(VERSION 3.20)
4
4
 
5
5
  project(leptris
6
- VERSION 1.9.403
6
+ VERSION 1.9.404
7
7
  DESCRIPTION "Fast XML parser and XPath evaluator in pure C"
8
8
  LANGUAGES C CXX
9
9
  )
@@ -1521,11 +1521,23 @@ static int dp_emit_element_open(const struct leptris_plan_result* v,
1521
1521
  }
1522
1522
  }
1523
1523
  for (size_t a = 0; a < v->attr_count; a++) {
1524
- if (!dp_sb_putn(b, " ", 1) || !dp_sb_puts(b, v->attr_names[a]) ||
1525
- !dp_sb_puts(b, "=\"") ||
1526
- !dp_sb_escape(b, v->attr_values[a], 1) ||
1527
- !dp_sb_putn(b, "\"", 1))
1528
- return 0;
1524
+ /* leptris#1941: a row with an emission binding spells
1525
+ * "prefix:local" (dp_wrapper_name's element contract);
1526
+ * the stored name stays the LOCAL name for host lookups. */
1527
+ char* qn = NULL;
1528
+ const char* nm = v->attr_names[a];
1529
+ if (v->attr_ns_prefixes && v->attr_ns_prefixes[a] && nm) {
1530
+ const char* colon = strchr(nm, ':');
1531
+ qn = dp_join_colon(v->attr_ns_prefixes[a],
1532
+ colon ? colon + 1 : nm);
1533
+ nm = qn;
1534
+ }
1535
+ int ok = nm && dp_sb_putn(b, " ", 1) && dp_sb_puts(b, nm) &&
1536
+ dp_sb_puts(b, "=\"") &&
1537
+ dp_sb_escape(b, v->attr_values[a], 1) &&
1538
+ dp_sb_putn(b, "\"", 1);
1539
+ free(qn);
1540
+ if (!ok) return 0;
1529
1541
  }
1530
1542
  return 1;
1531
1543
  }
@@ -1948,8 +1960,48 @@ static struct leptris_plan_result* plan_result_build_windowed(
1948
1960
  if (op->row_index != UINT32_MAX) {
1949
1961
  const leptris_child_plan* cr =
1950
1962
  &cp->child_plans[op->row_index];
1951
- v->ns_prefix = dp_strdup(cr->ns_prefix);
1952
- v->ns_uri = dp_strdup(cr->ns_uri);
1963
+ /* leptris#1941 emission inheritance (the DOM
1964
+ * lane's Namespaces planner contract): a row
1965
+ * without its own binding inherits the CHILD
1966
+ * plan's binding (nested rows spell the child's
1967
+ * namespace), else the row's OWN plan's binding
1968
+ * (rows of a namespaced plan spell the plan's
1969
+ * namespace). Explicit row bindings win. The URI
1970
+ * follows the prefix's plan. */
1971
+ const dp_plan* ns_src = NULL;
1972
+ if (cr->ns_prefix) {
1973
+ v->ns_prefix = dp_strdup(cr->ns_prefix);
1974
+ const dp_plan* tp =
1975
+ (cr->child_plan_index >= 0 &&
1976
+ cr->child_plan_index < (int32_t)pool->plan_count)
1977
+ ? &pool->plans[cr->child_plan_index]
1978
+ : NULL;
1979
+ v->ns_uri = dp_strdup(cr->ns_uri ? cr->ns_uri
1980
+ : tp->ns_uri);
1981
+ if (!v->ns_prefix || !v->ns_uri) goto oom;
1982
+ } else if (cr->child_plan_index >= 0 &&
1983
+ cr->child_plan_index <
1984
+ (int32_t)pool->plan_count &&
1985
+ pool->plans[cr->child_plan_index].ns_prefix &&
1986
+ pool->plans[cr->child_plan_index].ns_form ==
1987
+ LEPTRIS_PLAN_NS_EXACT) {
1988
+ ns_src = &pool->plans[cr->child_plan_index];
1989
+ } else if (cp->ns_prefix &&
1990
+ cp->ns_form == LEPTRIS_PLAN_NS_EXACT) {
1991
+ ns_src = cp;
1992
+ }
1993
+ if (ns_src) {
1994
+ v->ns_prefix = dp_strdup(ns_src->ns_prefix);
1995
+ v->ns_uri = dp_strdup(ns_src->ns_uri);
1996
+ if (!v->ns_prefix || !v->ns_uri) goto oom;
1997
+ }
1998
+ } else if (cp->ns_prefix &&
1999
+ cp->ns_form == LEPTRIS_PLAN_NS_EXACT) {
2000
+ /* leptris#1941: the root op binds the plan's own
2001
+ * emission prefix — the walk's stamp (#1551). */
2002
+ v->ns_prefix = dp_strdup(cp->ns_prefix);
2003
+ v->ns_uri = dp_strdup(cp->ns_uri);
2004
+ if (!v->ns_prefix || !v->ns_uri) goto oom;
1953
2005
  }
1954
2006
  if (sp == 0) {
1955
2007
  if (root) {
@@ -1995,6 +2047,28 @@ static struct leptris_plan_result* plan_result_build_windowed(
1995
2047
  if (op->row_index < cp->child_count)
1996
2048
  v->name = dp_strdup(
1997
2049
  cp->child_plans[op->row_index].wire_name);
2050
+ /* leptris#1941: scalar rows are their own wrapper
2051
+ * element — the row's emission binding rides the
2052
+ * value, same as ELEMENT ops (#1551); rows without a
2053
+ * binding inherit the plan's namespace. */
2054
+ if (op->row_index < cp->child_count) {
2055
+ const leptris_child_plan* cr =
2056
+ &cp->child_plans[op->row_index];
2057
+ const dp_plan* ns_src = NULL;
2058
+ if (cr->ns_prefix) {
2059
+ v->ns_prefix = dp_strdup(cr->ns_prefix);
2060
+ v->ns_uri = dp_strdup(cr->ns_uri);
2061
+ if (!v->ns_prefix || !v->ns_uri) goto oom;
2062
+ } else if (cp->ns_prefix &&
2063
+ cp->ns_form == LEPTRIS_PLAN_NS_EXACT) {
2064
+ ns_src = cp;
2065
+ }
2066
+ if (ns_src) {
2067
+ v->ns_prefix = dp_strdup(ns_src->ns_prefix);
2068
+ v->ns_uri = dp_strdup(ns_src->ns_uri);
2069
+ if (!v->ns_prefix || !v->ns_uri) goto oom;
2070
+ }
2071
+ }
1998
2072
  if (!dp_value_set_str(v, op->value ? op->value : "",
1999
2073
  op->value ? op->value_len : 0))
2000
2074
  dp_value_set_str(v, "", 0);
@@ -2066,6 +2140,23 @@ static struct leptris_plan_result* plan_result_build_windowed(
2066
2140
  op->value ? op->value_len : 0);
2067
2141
  gp[el->attr_count] = NULL;
2068
2142
  gu[el->attr_count] = NULL;
2143
+ /* leptris#1941: the attr row's emission binding —
2144
+ * ns_form EXACT rows spell "prefix:local" (#1551).
2145
+ * row_index out of range (host-synthesized attrs) has
2146
+ * no plan row: the fields stay NULL. */
2147
+ if (op->plan_index < pool->plan_count &&
2148
+ op->row_index <
2149
+ pool->plans[op->plan_index].attribute_count) {
2150
+ const leptris_attr_plan* ap =
2151
+ &pool->plans[op->plan_index]
2152
+ .attribute_plans[op->row_index];
2153
+ if (ap->ns_prefix) {
2154
+ gp[el->attr_count] = dp_strdup(ap->ns_prefix);
2155
+ gu[el->attr_count] = dp_strdup(ap->ns_uri);
2156
+ if (!gp[el->attr_count] || !gu[el->attr_count])
2157
+ goto oom;
2158
+ }
2159
+ }
2069
2160
  if (!gn[el->attr_count] || !gv[el->attr_count])
2070
2161
  goto oom;
2071
2162
  el->attr_count++;
@@ -191,6 +191,8 @@ static void xsd_cm_free(XsdCm* cm) {
191
191
  free(cm->not_qname);
192
192
  free(cm->any_unit_tns);
193
193
  free(cm->text_type);
194
+ free(cm->fixed_value);
195
+ free(cm->default_value);
194
196
  free(cm);
195
197
  cm = next;
196
198
  }
@@ -279,6 +281,13 @@ static XsdCm* xsd_cm_parse(struct leptris_xsd_schema* s,
279
281
  if (xsd_capture_inline(s, e, synth))
280
282
  cm->type = xsd_strdup(synth);
281
283
  }
284
+ /* leptris-rs#35 (isDefault005): particle value
285
+ * constraints — an empty child is satisfied BY its
286
+ * fixed/default value (§3.12.2). */
287
+ cm->fixed_value = xsd_strdup(
288
+ leptris_element_attribute(e, "fixed"));
289
+ cm->default_value = xsd_strdup(
290
+ leptris_element_attribute(e, "default"));
282
291
  }
283
292
  } else if (strcmp(local, "group") == 0) {
284
293
  /* <xs:group ref="g"/> — expanded at NFA build so
@@ -2471,6 +2480,9 @@ static void xsd_capture_root(struct leptris_xsd_schema* s,
2471
2480
  d->fixed = xsd_strdup(
2472
2481
  leptris_element_attribute((LeptrisElement)n,
2473
2482
  "fixed"));
2483
+ d->default_value = xsd_strdup(
2484
+ leptris_element_attribute((LeptrisElement)n,
2485
+ "default"));
2474
2486
  const char* sg = leptris_element_attribute(
2475
2487
  (LeptrisElement)n, "substitutionGroup");
2476
2488
  if (sg) {
@@ -2509,6 +2521,9 @@ static void xsd_capture_root(struct leptris_xsd_schema* s,
2509
2521
  d->fixed = xsd_strdup(
2510
2522
  leptris_element_attribute((LeptrisElement)n,
2511
2523
  "fixed"));
2524
+ d->default_value = xsd_strdup(
2525
+ leptris_element_attribute((LeptrisElement)n,
2526
+ "default"));
2512
2527
  const char* sg = leptris_element_attribute(
2513
2528
  (LeptrisElement)n, "substitutionGroup");
2514
2529
  if (sg) {
@@ -2706,6 +2721,7 @@ LEPTRIS_API void leptris_xsd_free(LeptrisXsdSchema schema) {
2706
2721
  free(d->name);
2707
2722
  free(d->type);
2708
2723
  free(d->fixed);
2724
+ free(d->default_value);
2709
2725
  free(d->sub_head);
2710
2726
  free(d);
2711
2727
  d = dn;
@@ -2922,6 +2938,10 @@ static XsdCm* xsd_capture_complex_model(struct leptris_xsd_schema* s,
2922
2938
  const char* name) {
2923
2939
  XsdCm* root = xsd_cm_new(XSD_CM_SEQ); /* wrapper keeps the name */
2924
2940
  if (!root) return NULL;
2941
+ /* leptris-rs#35 (ctA033, idF025's inline c): mixed="true" admits
2942
+ * character data even with no particle model — the flag must
2943
+ * survive capture or the validator treats the type as empty. */
2944
+ root->mixed = xsd_mixed_flag(ct);
2925
2945
  XsdAttrDecl* attrs = NULL;
2926
2946
  char* any_attr_ns = NULL;
2927
2947
  char* any_attr_not_qname = NULL;
@@ -300,12 +300,12 @@ static void validate_element(struct xsd_validator* v,
300
300
  static void validate_local(struct xsd_validator* v,
301
301
  struct leptris_xsd_schema* s,
302
302
  LeptrisElement elem, const char* local,
303
- const char* type);
303
+ const char* type, const char* fill);
304
304
  static void validate_local_uri(struct xsd_validator* v,
305
305
  struct leptris_xsd_schema* s,
306
306
  LeptrisElement elem, const char* local,
307
307
  const char* type, const char* euri,
308
- const char* xsi_q);
308
+ const char* xsi_q, const char* fill);
309
309
 
310
310
  /* #1879: the strongest processContents among the model's wildcards
311
311
  * whose namespace grammar admits (uri) — 2 skip, 1 lax, 0 strict,
@@ -351,8 +351,10 @@ static void validate_children(struct xsd_validator* v,
351
351
  * oracle rejects whitespace-only content too, #1691 law) */
352
352
  if (!model) {
353
353
  /* simpleContent types ride text_type with no particle —
354
- * their text is validated at the call site */
355
- if (!ct->text_type) {
354
+ * their text is validated at the call site. leptris-rs#35
355
+ * (ctA033, idF025's inline c): mixed="true" admits character
356
+ * content even with no particle model. */
357
+ if (!ct->text_type && !ct->mixed) {
356
358
  const char* et = leptris_element_text(elem);
357
359
  if (et && *et) {
358
360
  const char* pn = NULL;
@@ -504,6 +506,7 @@ static void validate_children(struct xsd_validator* v,
504
506
  int wpc = model_wildcard_pc(model, cu, xsd_target_ns(s));
505
507
  if (wpc == 2) continue;
506
508
  const char* ptype = NULL;
509
+ const char* pfill = NULL;
507
510
  if (model) {
508
511
  XsdCm* stack[64];
509
512
  int sp = 0;
@@ -514,6 +517,11 @@ static void validate_children(struct xsd_validator* v,
514
517
  if (p->kind == XSD_CM_ELEMENT && p->name &&
515
518
  strcmp(p->name, cl) == 0 && p->type) {
516
519
  ptype = p->type;
520
+ /* leptris-rs#35 (isDefault005): the
521
+ * particle's fixed/default value satisfies
522
+ * EMPTY content (§3.12.2). */
523
+ pfill = p->fixed_value ? p->fixed_value
524
+ : p->default_value;
517
525
  break;
518
526
  }
519
527
  if (p->kind == XSD_CM_GROUP_REF) {
@@ -540,10 +548,11 @@ static void validate_children(struct xsd_validator* v,
540
548
  verrf_atk(v, ce, "type-resolution", cl, "element", cl,
541
549
  "xsi:type prefix is not bound in the instance");
542
550
  } else {
543
- validate_local_uri(v, s, ce, cl, xlocal, xuri, cxsi);
551
+ validate_local_uri(v, s, ce, cl, xlocal, xuri, cxsi,
552
+ pfill);
544
553
  }
545
554
  } else {
546
- validate_local(v, s, ce, cl, ptype);
555
+ validate_local(v, s, ce, cl, ptype, pfill);
547
556
  }
548
557
  } else if (xsd_find_element_ns(s, cl, cu)) {
549
558
  validate_element(v, s, ce, 0);
@@ -830,7 +839,8 @@ static void validate_element(struct xsd_validator* v,
830
839
  * only non-empty content that differs violates (nine suite
831
840
  * rows flipped on the 1.9.402 ride; whitespace-only counts as
832
841
  * empty per the §3.3.4 initial reading). */
833
- if (d->fixed) {
842
+ const char* fill = NULL;
843
+ {
834
844
  const char* text = leptris_element_text(elem);
835
845
  int has_content = 0;
836
846
  if (text)
@@ -839,9 +849,17 @@ static void validate_element(struct xsd_validator* v,
839
849
  has_content = 1;
840
850
  break;
841
851
  }
842
- if (has_content && strcmp(text, d->fixed) != 0)
843
- verrfk(v, "content-model", "element", local,
844
- "content does not match the fixed value");
852
+ if (d->fixed) {
853
+ if (has_content && strcmp(text, d->fixed) != 0)
854
+ verrfk(v, "content-model", "element", local,
855
+ "content does not match the fixed value");
856
+ if (!has_content)
857
+ fill = d->fixed;
858
+ } else if (!has_content && d->default_value) {
859
+ /* leptris-rs#35 (stZ072): the default value supplies the
860
+ * content of an empty element (§3.12.2). */
861
+ fill = d->default_value;
862
+ }
845
863
  }
846
864
  if (!eff_type) return; /* anyType */
847
865
  /* XSD 1.0 §2.6.2/§3.3.4 (moxml#433): xsi:type on the instance
@@ -863,10 +881,11 @@ static void validate_element(struct xsd_validator* v,
863
881
  "xsi:type prefix is not bound in the instance");
864
882
  return;
865
883
  }
866
- validate_local_uri(v, s, elem, local, xlocal, xuri, xsi_q);
884
+ validate_local_uri(v, s, elem, local, xlocal, xuri, xsi_q,
885
+ fill);
867
886
  return;
868
887
  }
869
- validate_local(v, s, elem, local, eff_type);
888
+ validate_local(v, s, elem, local, eff_type, fill);
870
889
  }
871
890
 
872
891
  /* Validate one element against a type name that comes from a
@@ -875,17 +894,17 @@ static void validate_element(struct xsd_validator* v,
875
894
  static void validate_local(struct xsd_validator* v,
876
895
  struct leptris_xsd_schema* s,
877
896
  LeptrisElement elem, const char* local,
878
- const char* type) {
897
+ const char* type, const char* fill) {
879
898
  const char* euri = NULL;
880
899
  leptris_element_expanded_name(elem, NULL, NULL, &euri);
881
- validate_local_uri(v, s, elem, local, type, euri, NULL);
900
+ validate_local_uri(v, s, elem, local, type, euri, NULL, fill);
882
901
  }
883
902
 
884
903
  static void validate_local_uri(struct xsd_validator* v,
885
904
  struct leptris_xsd_schema* s,
886
905
  LeptrisElement elem, const char* local,
887
906
  const char* type, const char* euri,
888
- const char* xsi_q) {
907
+ const char* xsi_q, const char* fill) {
889
908
  if (!type) return;
890
909
  /* the type ref may name a FOREIGN namespace's type (OOXML:
891
910
  * wp:extent -> a:CT_PositiveSize2D) — resolve through the
@@ -950,9 +969,12 @@ static void validate_local_uri(struct xsd_validator* v,
950
969
  }
951
970
  if (ct->text_type) {
952
971
  /* empty content is still a lexical value — it faces the
953
- * facets (reG17: '' must fail the pattern) */
972
+ * facets (reG17: '' must fail the pattern). leptris-rs#35:
973
+ * an EMPTY element is satisfied BY its fixed/default
974
+ * value (§3.12.2) — the fill substitutes for the read. */
954
975
  const char* text = leptris_element_text(elem);
955
976
  if (!text) text = "";
977
+ if (fill && !*text) text = fill;
956
978
  text_valid(v, s, ct->text_type, text, ct->ns,
957
979
  "element", local, elem);
958
980
  }
@@ -976,6 +998,7 @@ static void validate_local_uri(struct xsd_validator* v,
976
998
  validate_attributes(v, s, elem, &k_no_attrs, NULL);
977
999
  const char* text = leptris_element_text(elem);
978
1000
  if (!text) text = "";
1001
+ if (fill && !*text) text = fill;
979
1002
  text_valid(v, s, type, text, euri, "element", local,
980
1003
  elem);
981
1004
  return;
@@ -996,6 +1019,7 @@ static void validate_local_uri(struct xsd_validator* v,
996
1019
  validate_attributes(v, s, elem, &k_no_attrs, NULL);
997
1020
  const char* text = leptris_element_text(elem);
998
1021
  if (!text) text = "";
1022
+ if (fill && !*text) text = fill;
999
1023
  text_valid(v, s, builtin, text, euri, "element",
1000
1024
  local, elem);
1001
1025
  return;
@@ -156,6 +156,14 @@ typedef struct xsd_cm {
156
156
  struct xsd_cm* open_any; /* XSD 1.1: xs:openContent wildcard */
157
157
  int oc_mode; /* 0 none/unset, 1 suffix, 2 interleave */
158
158
  int oc_owned; /* the wildcard node is this model's own */
159
+ /* leptris-rs#35: particle value constraints + the type's mixed
160
+ * flag. An empty element is satisfied BY its fixed/default value
161
+ * (XSD 1.0 §3.12.2/§4.3.1.2 — isDefault005); mixed="true"
162
+ * admits character data on a particle-less type (ctA033 and
163
+ * idF025's inline mixed c). */
164
+ char* fixed_value;
165
+ char* default_value;
166
+ int mixed;
159
167
  } XsdCm;
160
168
 
161
169
 
@@ -192,6 +200,8 @@ typedef struct xsd_element_decl {
192
200
  char* type; /* "xs:string"-style builtin or a local type name */
193
201
  XsdAlternative* alternatives; /* XSD 1.1 conditional types */
194
202
  char* fixed; /* fixed element content: text must string-equal it */
203
+ char* default_value; /* leptris-rs#35: supplies content when the
204
+ element is empty (stZ072) */
195
205
  char* sub_head; /* substitutionGroup head (local name after ':') */
196
206
  struct xsd_element_decl* next;
197
207
  } XsdElementDecl;
@@ -153,6 +153,9 @@ leptris_add_test(test_rng rng/test_rng.cpp)
153
153
  leptris_add_test(test_xsd_compile xsd/test_xsd_compile.cpp)
154
154
  target_compile_definitions(test_xsd_compile PRIVATE
155
155
  LEPTRIS_XSD_CASES_DIR="${CMAKE_CURRENT_SOURCE_DIR}/xsd/libxml2-cases")
156
+ leptris_add_test(test_rs35_regression xsd/test_rs35_regression.cpp)
157
+ target_compile_definitions(test_rs35_regression PRIVATE
158
+ LEPTRIS_XSD_CASES_DIR="${CMAKE_CURRENT_SOURCE_DIR}/xsd/libxml2-cases")
156
159
  target_compile_definitions(test_rng PRIVATE
157
160
  LEPTRIS_RNG_INCLUDE_DIR="${CMAKE_CURRENT_SOURCE_DIR}/rng/include-cases")
158
161
  leptris_add_test(test_rng_corpus rng/test_rng_corpus.cpp)