leptris 1.9.407.0 → 1.9.408.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 +10 -0
- data/vendor-src/libleptris/CMakeLists.txt +1 -1
- data/vendor-src/libleptris/src/leptris/descriptor/plan.c +63 -12
- data/vendor-src/libleptris/src/leptris/xsd/compile.c +41 -1
- data/vendor-src/libleptris/src/leptris/xsd/validate.c +92 -1
- data/vendor-src/libleptris/test/abi/test_descriptor.cpp +99 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/attgD019-set/attgD019.xsd +23 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/attgD019-set/attgD019a.xsd +4 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/stE-union-fixed/stE050.xml +1 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/stE-union-fixed/stE050.xsd +7 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/stE-union-fixed/stE055.xml +1 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/stE-union-fixed/stE055.xsd +7 -0
- data/vendor-src/libleptris/test/xsd/test_i1957_1958.cpp +35 -0
- data/vendor-src/libleptris/test/xsd/test_xsd_compile.cpp +26 -0
- data/vendor-src/libleptris/vcpkg.json +1 -1
- metadata +7 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 34d1611db686219acbaed081b637a0c36b53959fedcba506b79b77802363f421
|
|
4
|
+
data.tar.gz: 79a9c1ebfe9f121a760d341b24f2f30d85c3fff51522bf4ab6007ab20b09e9a3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 346ea572efb4315248b5b20eb5c03e4a29893f96002f74fce3d0b77f6d2d270414e48e2581e4c39739eb3d6b832443a56b3c9d4c8ace66709d06aa718b2e35e3
|
|
7
|
+
data.tar.gz: 1f9a9215433bc6fb69a87becf524f3d25efd0e24e98a916e0dbf1efce8434255ca33f3b64b577cbdab99715ff7fb55c52c5d89da1b8e3d8508893a624ba8f6ad
|
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.408"
|
|
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,15 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [1.9.408] - 2026-11-05
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- emit default-xmlns declarations for prefix-less EXACT rows (#1969) (descriptor)
|
|
8
|
+
- the union value-space fix + default-xmlns emission (leptris-rs#45, leptris#1969) (engine)
|
|
9
|
+
- union-typed fixed constraints compare in the value space (leptris-rs#45) (xsd)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
3
13
|
## [1.9.407] - 2026-11-05
|
|
4
14
|
|
|
5
15
|
### Fixed
|
|
@@ -1525,7 +1525,8 @@ static char* dp_wrapper_name(const struct leptris_plan_result* v) {
|
|
|
1525
1525
|
|
|
1526
1526
|
static int dp_emit_element_open(const struct leptris_plan_result* v,
|
|
1527
1527
|
const char* name, dp_sb* b,
|
|
1528
|
-
const dp_decls* decls, int is_root
|
|
1528
|
+
const dp_decls* decls, int is_root,
|
|
1529
|
+
const char* default_claim) {
|
|
1529
1530
|
if (!dp_sb_putn(b, "<", 1) || !dp_sb_puts(b, name)) return 0;
|
|
1530
1531
|
if (is_root && decls) {
|
|
1531
1532
|
for (size_t i = 0; i < decls->n; i++) {
|
|
@@ -1535,6 +1536,17 @@ static int dp_emit_element_open(const struct leptris_plan_result* v,
|
|
|
1535
1536
|
return 0;
|
|
1536
1537
|
}
|
|
1537
1538
|
}
|
|
1539
|
+
/* leptris#1969: a prefix-less EXACT binding is the DEFAULT
|
|
1540
|
+
* namespace — emit the bare local name and declare xmlns="uri"
|
|
1541
|
+
* when the claim differs from the in-scope default (the root
|
|
1542
|
+
* hoists it once; deeper same-uri nodes inherit). Attribute
|
|
1543
|
+
* rows never take this form (W3C: attributes cannot
|
|
1544
|
+
* default-bind). */
|
|
1545
|
+
if (default_claim) {
|
|
1546
|
+
if (!dp_sb_puts(b, " xmlns=\"") ||
|
|
1547
|
+
!dp_sb_puts(b, default_claim) || !dp_sb_putn(b, "\"", 1))
|
|
1548
|
+
return 0;
|
|
1549
|
+
}
|
|
1538
1550
|
for (size_t a = 0; a < v->attr_count; a++) {
|
|
1539
1551
|
/* leptris#1941: a row with an emission binding spells
|
|
1540
1552
|
* "prefix:local" (dp_wrapper_name's element contract);
|
|
@@ -1584,14 +1596,17 @@ static int dp_sb_indent_newline(dp_sb* b, const dp_fmt* fmt, int depth) {
|
|
|
1584
1596
|
static int dp_emit_value(const struct leptris_plan_result* v,
|
|
1585
1597
|
const dp_plan* container, const LeptrisPlan pool,
|
|
1586
1598
|
dp_sb* b, const dp_decls* decls, int is_root,
|
|
1587
|
-
const dp_fmt* fmt, int depth
|
|
1599
|
+
const dp_fmt* fmt, int depth,
|
|
1600
|
+
const char* cur_default);
|
|
1588
1601
|
|
|
1589
1602
|
static int dp_emit_element(const struct leptris_plan_result* v,
|
|
1590
1603
|
const char* name, const LeptrisPlan pool,
|
|
1591
1604
|
const dp_plan* kids_container, dp_sb* b,
|
|
1592
1605
|
const dp_decls* decls, int is_root,
|
|
1593
|
-
const dp_fmt* fmt, int depth
|
|
1594
|
-
|
|
1606
|
+
const dp_fmt* fmt, int depth,
|
|
1607
|
+
const char* cur_default) {
|
|
1608
|
+
if (!dp_emit_element_open(v, name, b, decls, is_root, cur_default))
|
|
1609
|
+
return 0;
|
|
1595
1610
|
const struct leptris_plan_result** kids = NULL;
|
|
1596
1611
|
size_t nk = 0, cap = 0;
|
|
1597
1612
|
if (!dp_flatten_kids(v, &kids, &nk, &cap)) {
|
|
@@ -1616,6 +1631,10 @@ static int dp_emit_element(const struct leptris_plan_result* v,
|
|
|
1616
1631
|
* parent), so a nested member resolved its kids' rows against
|
|
1617
1632
|
* the parent's rows and a CONTENT row serialized as an
|
|
1618
1633
|
* empty-named wrapper. */
|
|
1634
|
+
/* leptris#1969: this element's own claim sets the kids'
|
|
1635
|
+
* in-scope default (a default-xmlns re-declaration nests). */
|
|
1636
|
+
const char* kid_default = cur_default;
|
|
1637
|
+
if (v->ns_uri && !v->ns_prefix) kid_default = v->ns_uri;
|
|
1619
1638
|
int ok = 1;
|
|
1620
1639
|
for (size_t i = 0; i < nk && ok; i++) {
|
|
1621
1640
|
if (indent_kids && !dp_sb_indent_newline(b, fmt, depth + 1)) {
|
|
@@ -1623,7 +1642,8 @@ static int dp_emit_element(const struct leptris_plan_result* v,
|
|
|
1623
1642
|
break;
|
|
1624
1643
|
}
|
|
1625
1644
|
ok = dp_emit_value(kids[i], kids_container, pool, b, NULL, 0,
|
|
1626
|
-
fmt, indent_kids ? depth + 1 : depth
|
|
1645
|
+
fmt, indent_kids ? depth + 1 : depth,
|
|
1646
|
+
kid_default);
|
|
1627
1647
|
}
|
|
1628
1648
|
free((void*)kids);
|
|
1629
1649
|
if (!ok) return 0;
|
|
@@ -1638,7 +1658,8 @@ static int dp_emit_element(const struct leptris_plan_result* v,
|
|
|
1638
1658
|
static int dp_emit_value(const struct leptris_plan_result* v,
|
|
1639
1659
|
const dp_plan* container, const LeptrisPlan pool,
|
|
1640
1660
|
dp_sb* b, const dp_decls* decls, int is_root,
|
|
1641
|
-
const dp_fmt* fmt, int depth
|
|
1661
|
+
const dp_fmt* fmt, int depth,
|
|
1662
|
+
const char* cur_default) {
|
|
1642
1663
|
if (v->kind == LEPTRIS_PLAN_VALUE_RAW)
|
|
1643
1664
|
return dp_sb_puts(b, v->str ? v->str : "");
|
|
1644
1665
|
if (v->kind == LEPTRIS_PLAN_VALUE_ELEMENT) {
|
|
@@ -1688,8 +1709,17 @@ static int dp_emit_value(const struct leptris_plan_result* v,
|
|
|
1688
1709
|
kids_container =
|
|
1689
1710
|
&poolp->plans[cap->child_plan_index];
|
|
1690
1711
|
}
|
|
1712
|
+
/* leptris#1969: this node's default-xmlns claim (a ns_uri
|
|
1713
|
+
* without a prefix). Emitted only when it differs from the
|
|
1714
|
+
* in-scope default; the kids inherit the claim. */
|
|
1715
|
+
const char* claim =
|
|
1716
|
+
(v->ns_uri && !v->ns_prefix) ? v->ns_uri : NULL;
|
|
1717
|
+
const char* open_claim =
|
|
1718
|
+
(claim && (!cur_default || strcmp(claim, cur_default) != 0))
|
|
1719
|
+
? claim
|
|
1720
|
+
: NULL;
|
|
1691
1721
|
int ok = dp_emit_element(v, name, pool, kids_container, b,
|
|
1692
|
-
decls, is_root, fmt, depth);
|
|
1722
|
+
decls, is_root, fmt, depth, open_claim);
|
|
1693
1723
|
free(name);
|
|
1694
1724
|
return ok;
|
|
1695
1725
|
}
|
|
@@ -1703,7 +1733,16 @@ static int dp_emit_value(const struct leptris_plan_result* v,
|
|
|
1703
1733
|
/* The row is the wrapper element around this text. */
|
|
1704
1734
|
char* name = dp_wrapper_name(v);
|
|
1705
1735
|
if (!name) return 0;
|
|
1736
|
+
/* leptris#1969: the wrapper's own default-xmlns claim. */
|
|
1737
|
+
const char* wclaim =
|
|
1738
|
+
(v->ns_uri && !v->ns_prefix &&
|
|
1739
|
+
(!cur_default || strcmp(v->ns_uri, cur_default) != 0))
|
|
1740
|
+
? v->ns_uri
|
|
1741
|
+
: NULL;
|
|
1706
1742
|
int ok = dp_sb_putn(b, "<", 1) && dp_sb_puts(b, name) &&
|
|
1743
|
+
(wclaim ? dp_sb_puts(b, " xmlns=\"") &&
|
|
1744
|
+
dp_sb_puts(b, wclaim) && dp_sb_putn(b, "\"", 1)
|
|
1745
|
+
: 1) &&
|
|
1707
1746
|
dp_sb_putn(b, ">", 1) && dp_sb_escape(b, text, 0) &&
|
|
1708
1747
|
dp_sb_puts(b, "</") && dp_sb_puts(b, name) &&
|
|
1709
1748
|
dp_sb_putn(b, ">", 1);
|
|
@@ -1732,7 +1771,7 @@ static char* dp_serialize_impl(LeptrisPlan plan,
|
|
|
1732
1771
|
}
|
|
1733
1772
|
dp_sb b = {0};
|
|
1734
1773
|
int ok = dp_emit_value(rv, NULL, (const LeptrisPlan)plan, &b,
|
|
1735
|
-
&decls, 1, fmt, 0);
|
|
1774
|
+
&decls, 1, fmt, 0, NULL);
|
|
1736
1775
|
dp_decls_free(&decls);
|
|
1737
1776
|
if (!ok) {
|
|
1738
1777
|
free(b.s);
|
|
@@ -1997,18 +2036,23 @@ static struct leptris_plan_result* plan_result_build_windowed(
|
|
|
1997
2036
|
} else if (cr->child_plan_index >= 0 &&
|
|
1998
2037
|
cr->child_plan_index <
|
|
1999
2038
|
(int32_t)pool->plan_count &&
|
|
2000
|
-
pool->plans[cr->child_plan_index].
|
|
2039
|
+
pool->plans[cr->child_plan_index].ns_uri &&
|
|
2001
2040
|
pool->plans[cr->child_plan_index].ns_form ==
|
|
2002
2041
|
LEPTRIS_PLAN_NS_EXACT) {
|
|
2003
2042
|
ns_src = &pool->plans[cr->child_plan_index];
|
|
2004
|
-
} else if (cp->
|
|
2043
|
+
} else if (cp->ns_uri &&
|
|
2005
2044
|
cp->ns_form == LEPTRIS_PLAN_NS_EXACT) {
|
|
2006
2045
|
ns_src = cp;
|
|
2007
2046
|
}
|
|
2008
2047
|
if (ns_src) {
|
|
2009
|
-
|
|
2048
|
+
/* leptris#1969: ns_prefix NULL + ns_uri set is
|
|
2049
|
+
* the DEFAULT-xmlns claim (bare local name,
|
|
2050
|
+
* xmlns="uri" hoisted on the emitting root). */
|
|
2051
|
+
v->ns_prefix = ns_src->ns_prefix
|
|
2052
|
+
? dp_strdup(ns_src->ns_prefix)
|
|
2053
|
+
: NULL;
|
|
2010
2054
|
v->ns_uri = dp_strdup(ns_src->ns_uri);
|
|
2011
|
-
if (!v->
|
|
2055
|
+
if (!v->ns_uri) goto oom;
|
|
2012
2056
|
}
|
|
2013
2057
|
} else if (cp->ns_prefix &&
|
|
2014
2058
|
cp->ns_form == LEPTRIS_PLAN_NS_EXACT) {
|
|
@@ -2017,6 +2061,13 @@ static struct leptris_plan_result* plan_result_build_windowed(
|
|
|
2017
2061
|
v->ns_prefix = dp_strdup(cp->ns_prefix);
|
|
2018
2062
|
v->ns_uri = dp_strdup(cp->ns_uri);
|
|
2019
2063
|
if (!v->ns_prefix || !v->ns_uri) goto oom;
|
|
2064
|
+
} else if (cp->ns_uri &&
|
|
2065
|
+
cp->ns_form == LEPTRIS_PLAN_NS_EXACT) {
|
|
2066
|
+
/* leptris#1969: the root op binds the plan's own
|
|
2067
|
+
* DEFAULT namespace (prefix-less EXACT) —
|
|
2068
|
+
* xmlns="uri" hoists on the output root. */
|
|
2069
|
+
v->ns_uri = dp_strdup(cp->ns_uri);
|
|
2070
|
+
if (!v->ns_uri) goto oom;
|
|
2020
2071
|
}
|
|
2021
2072
|
if (sp == 0) {
|
|
2022
2073
|
if (root) {
|
|
@@ -126,6 +126,8 @@ static XsdAssert* xsd_capture_assert(struct leptris_xsd_schema* s,
|
|
|
126
126
|
static XsdCm* xsd_capture_any(LeptrisElement any_child);
|
|
127
127
|
static char* xsd_capture_unit_tns(LeptrisElement e);
|
|
128
128
|
static char* xsd_capture_any_attr_ns(LeptrisElement container);
|
|
129
|
+
static char* xsd_capture_any_attr_ns_deep(
|
|
130
|
+
struct leptris_xsd_schema* s, LeptrisElement container, int depth);
|
|
129
131
|
static char* xsd_capture_any_attr_not_qname(LeptrisElement container);
|
|
130
132
|
|
|
131
133
|
/* #1626: prefixed QName refs (type="w:CT_Border") resolve by local
|
|
@@ -3293,7 +3295,8 @@ static XsdCm* xsd_capture_complex_model(struct leptris_xsd_schema* s,
|
|
|
3293
3295
|
if (!attrs) attrs = xsd_capture_attr_rows(s, ct, 0);
|
|
3294
3296
|
if (!any_attr_unit_ns)
|
|
3295
3297
|
any_attr_unit_ns = xsd_capture_unit_tns(ct);
|
|
3296
|
-
if (!any_attr_ns)
|
|
3298
|
+
if (!any_attr_ns)
|
|
3299
|
+
any_attr_ns = xsd_capture_any_attr_ns_deep(s, ct, 0);
|
|
3297
3300
|
if (!any_attr_not_qname)
|
|
3298
3301
|
any_attr_not_qname = xsd_capture_any_attr_not_qname(ct);
|
|
3299
3302
|
}
|
|
@@ -3623,6 +3626,43 @@ static char* xsd_capture_unit_tns(LeptrisElement e) {
|
|
|
3623
3626
|
return NULL;
|
|
3624
3627
|
}
|
|
3625
3628
|
|
|
3629
|
+
/* leptris#1964: the anyAttribute grammar rides attributeGroup
|
|
3630
|
+
* refs too — attgD019's wildcard lives inside the referenced
|
|
3631
|
+
* group, not the complexType's direct children. Follows refs
|
|
3632
|
+
* (depth-bounded); the group's OWN element is the walk root. */
|
|
3633
|
+
static char* xsd_capture_any_attr_ns_deep(
|
|
3634
|
+
struct leptris_xsd_schema* s, LeptrisElement container,
|
|
3635
|
+
int depth) {
|
|
3636
|
+
if (depth > 8) return NULL;
|
|
3637
|
+
for (LeptrisNodeRef ac = leptris_node_first_child(
|
|
3638
|
+
leptris_element_as_node(container));
|
|
3639
|
+
ac; ac = leptris_node_next_sibling(ac)) {
|
|
3640
|
+
if (leptris_node_get_type(ac) != LEPTRIS_NODE_TYPE_ELEMENT)
|
|
3641
|
+
continue;
|
|
3642
|
+
LeptrisElement ae = (LeptrisElement)ac;
|
|
3643
|
+
const char* al = NULL, *au = NULL;
|
|
3644
|
+
leptris_element_expanded_name(ae, &al, NULL, &au);
|
|
3645
|
+
if (!al || (au && strcmp(au, XSD_NS) != 0)) continue;
|
|
3646
|
+
if (strcmp(al, "anyAttribute") == 0)
|
|
3647
|
+
return xsd_strdup(
|
|
3648
|
+
leptris_element_attribute(ae, "namespace"));
|
|
3649
|
+
if (strcmp(al, "attributeGroup") == 0) {
|
|
3650
|
+
const char* ref = xsd_local_name(
|
|
3651
|
+
leptris_element_attribute(ae, "ref"));
|
|
3652
|
+
if (!ref) continue;
|
|
3653
|
+
XsdAttrGroupDef* g = s->attr_groups;
|
|
3654
|
+
for (; g; g = g->next)
|
|
3655
|
+
if (strcmp(g->name, ref) == 0) break;
|
|
3656
|
+
if (g && g->elem) {
|
|
3657
|
+
char* r = xsd_capture_any_attr_ns_deep(s, g->elem,
|
|
3658
|
+
depth + 1);
|
|
3659
|
+
if (r) return r;
|
|
3660
|
+
}
|
|
3661
|
+
}
|
|
3662
|
+
}
|
|
3663
|
+
return NULL;
|
|
3664
|
+
}
|
|
3665
|
+
|
|
3626
3666
|
static char* xsd_capture_any_attr_ns(LeptrisElement container) {
|
|
3627
3667
|
for (LeptrisNodeRef ac = leptris_node_first_child(
|
|
3628
3668
|
leptris_element_as_node(container));
|
|
@@ -301,6 +301,88 @@ static int text_valid(struct xsd_validator* v,
|
|
|
301
301
|
static void validate_element(struct xsd_validator* v,
|
|
302
302
|
struct leptris_xsd_schema* s,
|
|
303
303
|
LeptrisElement elem, int depth);
|
|
304
|
+
static void xsd_member_canon(const char* mname, char* out, size_t cap) {
|
|
305
|
+
const char* local = mname ? strchr(mname, ':') : NULL;
|
|
306
|
+
local = local ? local + 1 : mname;
|
|
307
|
+
snprintf(out, cap, "xs:%s", local ? local : "");
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/* Value-space equality within one union member: numerics compare
|
|
311
|
+
* numerically ("1.0" == "1.000"), booleans identify across the
|
|
312
|
+
* {true,1}/{false,0} spellings, everything else is exact text. */
|
|
313
|
+
static int xsd_value_equal(const char* canon_type, const char* a,
|
|
314
|
+
const char* b) {
|
|
315
|
+
if (strcmp(a, b) == 0) return 1;
|
|
316
|
+
if (strcmp(canon_type, "xs:boolean") == 0) {
|
|
317
|
+
int av = strcmp(a, "true") == 0 || strcmp(a, "1") == 0;
|
|
318
|
+
int bv = strcmp(b, "true") == 0 || strcmp(b, "1") == 0;
|
|
319
|
+
return av == bv;
|
|
320
|
+
}
|
|
321
|
+
if (strcmp(canon_type, "xs:float") == 0 ||
|
|
322
|
+
strcmp(canon_type, "xs:double") == 0)
|
|
323
|
+
return strtod(a, NULL) == strtod(b, NULL);
|
|
324
|
+
if (strstr(canon_type, "int") || strstr(canon_type, "decimal") ||
|
|
325
|
+
strstr(canon_type, "long") || strstr(canon_type, "short") ||
|
|
326
|
+
strstr(canon_type, "byte") ||
|
|
327
|
+
strstr(canon_type, "Negative") || strstr(canon_type, "positive"))
|
|
328
|
+
return strtod(a, NULL) == strtod(b, NULL);
|
|
329
|
+
return 0;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/* leptris-rs#45 (stE050/stE055): union-typed fixed constraints
|
|
333
|
+
* compare in the VALUE SPACE of the first union member that
|
|
334
|
+
* validates each lexical form — fixed "1" and instance "true"
|
|
335
|
+
* both validate as xs:boolean (its lexical space accepts "1");
|
|
336
|
+
* "1.0" and "1.000" both as xs:float. Raw strcmp wrongly
|
|
337
|
+
* rejected value-equal forms. Returns 1 when a single member
|
|
338
|
+
* type validates both the fixed value and the instance text. */
|
|
339
|
+
static int xsd_union_fixed_match(struct leptris_xsd_schema* s,
|
|
340
|
+
const XsdSimple* ut, const char* ns,
|
|
341
|
+
const char* fixed, const char* text) {
|
|
342
|
+
if (!ut || ut->deriv != XSD_SIMPLE_UNION) return 0;
|
|
343
|
+
size_t n = ut->member_count > ut->member_def_count
|
|
344
|
+
? ut->member_count
|
|
345
|
+
: ut->member_def_count;
|
|
346
|
+
int fixed_member = -1;
|
|
347
|
+
for (size_t i = 0; i < n && fixed_member < 0; i++) {
|
|
348
|
+
const XsdSimple* def =
|
|
349
|
+
i < ut->member_def_count ? ut->member_defs[i] : NULL;
|
|
350
|
+
const char* mname = i < ut->member_count ? ut->members[i] : NULL;
|
|
351
|
+
int ok;
|
|
352
|
+
char canon[128];
|
|
353
|
+
if (mname) xsd_member_canon(mname, canon, sizeof(canon));
|
|
354
|
+
if (def) {
|
|
355
|
+
ok = xsd_simple_valid_chain(s, def, fixed);
|
|
356
|
+
} else if (mname && strncmp(canon, "xs:", 3) == 0) {
|
|
357
|
+
ok = xsd_builtin_valid(canon, fixed);
|
|
358
|
+
} else if (mname) {
|
|
359
|
+
const XsdSimple* m = xsd_find_simple_ns_pub(s, canon, ns);
|
|
360
|
+
ok = m && xsd_simple_valid_chain(s, m, fixed);
|
|
361
|
+
} else {
|
|
362
|
+
continue;
|
|
363
|
+
}
|
|
364
|
+
if (ok) fixed_member = (int)i;
|
|
365
|
+
}
|
|
366
|
+
if (fixed_member < 0) return 0;
|
|
367
|
+
const XsdSimple* def =
|
|
368
|
+
(size_t)fixed_member < ut->member_def_count
|
|
369
|
+
? ut->member_defs[fixed_member]
|
|
370
|
+
: NULL;
|
|
371
|
+
if (def) return xsd_simple_valid_chain(s, def, text) &&
|
|
372
|
+
xsd_value_equal("xs:string", fixed, text);
|
|
373
|
+
const char* mname = (size_t)fixed_member < ut->member_count
|
|
374
|
+
? ut->members[fixed_member]
|
|
375
|
+
: NULL;
|
|
376
|
+
if (!mname) return 0;
|
|
377
|
+
char canon[128];
|
|
378
|
+
xsd_member_canon(mname, canon, sizeof(canon));
|
|
379
|
+
if (strncmp(canon, "xs:", 3) == 0)
|
|
380
|
+
return xsd_builtin_valid(canon, text) &&
|
|
381
|
+
xsd_value_equal(canon, fixed, text);
|
|
382
|
+
const XsdSimple* m = xsd_find_simple_ns_pub(s, canon, ns);
|
|
383
|
+
return m && xsd_simple_valid_chain(s, m, text);
|
|
384
|
+
}
|
|
385
|
+
|
|
304
386
|
static void validate_element_decl(struct xsd_validator* v,
|
|
305
387
|
struct leptris_xsd_schema* s,
|
|
306
388
|
LeptrisElement elem, int depth,
|
|
@@ -913,7 +995,16 @@ static void validate_element_decl(struct xsd_validator* v,
|
|
|
913
995
|
break;
|
|
914
996
|
}
|
|
915
997
|
if (d->fixed) {
|
|
916
|
-
|
|
998
|
+
int match = !has_content || strcmp(text, d->fixed) == 0;
|
|
999
|
+
if (!match) {
|
|
1000
|
+
const XsdSimple* ut =
|
|
1001
|
+
d->type ? xsd_find_simple_ns_pub(s, d->type, d->ns)
|
|
1002
|
+
: NULL;
|
|
1003
|
+
if (ut)
|
|
1004
|
+
match = xsd_union_fixed_match(s, ut, d->ns, d->fixed,
|
|
1005
|
+
text);
|
|
1006
|
+
}
|
|
1007
|
+
if (!match)
|
|
917
1008
|
verrfk(v, "content-model", "element", local,
|
|
918
1009
|
"content does not match the fixed value");
|
|
919
1010
|
if (!has_content)
|
|
@@ -2786,6 +2786,105 @@ TEST(Plan1941, ResultBuildExplicitRowBindingBeatsInheritance) {
|
|
|
2786
2786
|
leptris_plan_free(plan);
|
|
2787
2787
|
}
|
|
2788
2788
|
|
|
2789
|
+
// ---- leptris#1969: prefix-less EXACT rows are the DEFAULT xmlns --
|
|
2790
|
+
// ns_form EXACT with ns_uri but NO ns_prefix binds the default
|
|
2791
|
+
// namespace: the element emits a bare local name and hoists
|
|
2792
|
+
// xmlns="uri". The declaration appears once on the output root;
|
|
2793
|
+
// same-uri descendants inherit it (no re-declare); a deeper
|
|
2794
|
+
// different default re-declares. Attribute rows never default-bind
|
|
2795
|
+
// (pinned by the Plan1486 cases — the attr row's ns_prefix gate).
|
|
2796
|
+
|
|
2797
|
+
TEST(Plan1969, ResultBuildEmitsDefaultXmlnsOnRoot) {
|
|
2798
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
2799
|
+
leptris_child_plan kids[1] = {};
|
|
2800
|
+
kids[0].wire_name = "p";
|
|
2801
|
+
kids[0].kind = LEPTRIS_PLAN_KIND_SCALAR;
|
|
2802
|
+
kids[0].child_plan_index = -1;
|
|
2803
|
+
kids[0].ns_form = LEPTRIS_PLAN_NS_EXACT;
|
|
2804
|
+
kids[0].ns_uri = "urn:w";
|
|
2805
|
+
|
|
2806
|
+
leptris_element_plan plans[1] = {};
|
|
2807
|
+
plans[0].element_name = "document";
|
|
2808
|
+
plans[0].ns_form = LEPTRIS_PLAN_NS_EXACT;
|
|
2809
|
+
plans[0].ns_uri = "urn:w";
|
|
2810
|
+
plans[0].child_count = 1;
|
|
2811
|
+
plans[0].child_plans = kids;
|
|
2812
|
+
|
|
2813
|
+
leptris_plan_spec spec = {};
|
|
2814
|
+
spec.abi_version = leptris_plan_abi_version();
|
|
2815
|
+
spec.plan_count = 1;
|
|
2816
|
+
spec.plans = plans;
|
|
2817
|
+
LeptrisPlan plan = leptris_plan_build(&spec, &st);
|
|
2818
|
+
ASSERT_NE(plan, nullptr);
|
|
2819
|
+
|
|
2820
|
+
leptris_plan_row_op ops[] = {
|
|
2821
|
+
{LEPTRIS_PLAN_OP_ELEMENT, 0, UINT32_MAX, NULL, NULL, 0},
|
|
2822
|
+
{LEPTRIS_PLAN_OP_SCALAR, 0, 0, NULL, "x", 1},
|
|
2823
|
+
{LEPTRIS_PLAN_OP_END, 0, UINT32_MAX, NULL, NULL, 0},
|
|
2824
|
+
};
|
|
2825
|
+
LeptrisPlanResult r = leptris_plan_result_build(plan, ops, 3, &st);
|
|
2826
|
+
ASSERT_NE(r, nullptr);
|
|
2827
|
+
char* out = leptris_plan_serialize(plan, r, &st);
|
|
2828
|
+
ASSERT_NE(out, nullptr);
|
|
2829
|
+
EXPECT_STREQ(out, "<document xmlns=\"urn:w\"><p>x</p></document>");
|
|
2830
|
+
leptris_free_string(out);
|
|
2831
|
+
leptris_plan_result_free(r);
|
|
2832
|
+
leptris_plan_free(plan);
|
|
2833
|
+
}
|
|
2834
|
+
|
|
2835
|
+
TEST(Plan1969, ResultBuildNestedDefaultRedeclaresDifferentUri) {
|
|
2836
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
2837
|
+
leptris_child_plan a_kids[1] = {};
|
|
2838
|
+
a_kids[0].wire_name = "b";
|
|
2839
|
+
a_kids[0].kind = LEPTRIS_PLAN_KIND_NESTED;
|
|
2840
|
+
a_kids[0].child_plan_index = 1;
|
|
2841
|
+
|
|
2842
|
+
leptris_child_plan b_kids[1] = {};
|
|
2843
|
+
b_kids[0].wire_name = "c";
|
|
2844
|
+
b_kids[0].kind = LEPTRIS_PLAN_KIND_SCALAR;
|
|
2845
|
+
b_kids[0].child_plan_index = -1;
|
|
2846
|
+
|
|
2847
|
+
leptris_element_plan plans[2] = {};
|
|
2848
|
+
plans[0].element_name = "a";
|
|
2849
|
+
plans[0].ns_form = LEPTRIS_PLAN_NS_EXACT;
|
|
2850
|
+
plans[0].ns_uri = "urn:1";
|
|
2851
|
+
plans[0].child_count = 1;
|
|
2852
|
+
plans[0].child_plans = a_kids;
|
|
2853
|
+
plans[1].element_name = "b";
|
|
2854
|
+
plans[1].ns_form = LEPTRIS_PLAN_NS_EXACT;
|
|
2855
|
+
plans[1].ns_uri = "urn:2";
|
|
2856
|
+
plans[1].child_count = 1;
|
|
2857
|
+
plans[1].child_plans = b_kids;
|
|
2858
|
+
|
|
2859
|
+
leptris_plan_spec spec = {};
|
|
2860
|
+
spec.abi_version = leptris_plan_abi_version();
|
|
2861
|
+
spec.plan_count = 2;
|
|
2862
|
+
spec.plans = plans;
|
|
2863
|
+
LeptrisPlan plan = leptris_plan_build(&spec, &st);
|
|
2864
|
+
ASSERT_NE(plan, nullptr);
|
|
2865
|
+
|
|
2866
|
+
leptris_plan_row_op ops[] = {
|
|
2867
|
+
{LEPTRIS_PLAN_OP_ELEMENT, 0, UINT32_MAX, NULL, NULL, 0},
|
|
2868
|
+
{LEPTRIS_PLAN_OP_ELEMENT, 0, 0, NULL, NULL, 0},
|
|
2869
|
+
{LEPTRIS_PLAN_OP_SCALAR, 1, 0, NULL, "x", 1},
|
|
2870
|
+
{LEPTRIS_PLAN_OP_END, 0, UINT32_MAX, NULL, NULL, 0},
|
|
2871
|
+
{LEPTRIS_PLAN_OP_END, 0, UINT32_MAX, NULL, NULL, 0},
|
|
2872
|
+
};
|
|
2873
|
+
LeptrisPlanResult r = leptris_plan_result_build(plan, ops, 5, &st);
|
|
2874
|
+
ASSERT_NE(r, nullptr);
|
|
2875
|
+
char* out = leptris_plan_serialize(plan, r, &st);
|
|
2876
|
+
ASSERT_NE(out, nullptr);
|
|
2877
|
+
/* b's nested row inherits its child plan's DEFAULT binding —
|
|
2878
|
+
* urn:2 differs from the in-scope urn:1, so b re-declares; c
|
|
2879
|
+
* inherits urn:2 and spells bare. */
|
|
2880
|
+
EXPECT_STREQ(out,
|
|
2881
|
+
"<a xmlns=\"urn:1\"><b xmlns=\"urn:2\">"
|
|
2882
|
+
"<c>x</c></b></a>");
|
|
2883
|
+
leptris_free_string(out);
|
|
2884
|
+
leptris_plan_result_free(r);
|
|
2885
|
+
leptris_plan_free(plan);
|
|
2886
|
+
}
|
|
2887
|
+
|
|
2789
2888
|
TEST(Plan408, ResultBuildRejectsBadPrograms) {
|
|
2790
2889
|
LeptrisStatus st = LEPTRIS_OK;
|
|
2791
2890
|
leptris_element_plan plans[1] = {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<?xml version="1.0"?>
|
|
2
|
+
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified">
|
|
3
|
+
<xsd:attribute name="foo" type="xsd:string"/>
|
|
4
|
+
<xsd:attribute name="bar" type="xsd:string"/>
|
|
5
|
+
<xsd:attributeGroup name="attG" id="abc" xmlns:foo="foo" foo:anyattribute="foo">
|
|
6
|
+
<xsd:attribute name="att1" type="xsd:int"/>
|
|
7
|
+
<xsd:anyAttribute namespace="##any" id="anyAtt">
|
|
8
|
+
<xsd:annotation>
|
|
9
|
+
<xsd:documentation> testing </xsd:documentation>
|
|
10
|
+
</xsd:annotation>
|
|
11
|
+
</xsd:anyAttribute>
|
|
12
|
+
</xsd:attributeGroup>
|
|
13
|
+
<xsd:complexType name="attgRef">
|
|
14
|
+
<xsd:attributeGroup ref="attG"/>
|
|
15
|
+
</xsd:complexType>
|
|
16
|
+
<xsd:element name="doc">
|
|
17
|
+
<xsd:complexType>
|
|
18
|
+
<xsd:choice maxOccurs="10">
|
|
19
|
+
<xsd:element name="elem" type="attgRef"/>
|
|
20
|
+
</xsd:choice>
|
|
21
|
+
</xsd:complexType>
|
|
22
|
+
</xsd:element>
|
|
23
|
+
</xsd:schema>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<root>true</root>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<root>1.000</root>
|
|
@@ -88,3 +88,38 @@ TEST(I1958, RedefinedSimpleTypeFacetEnforced) {
|
|
|
88
88
|
leptris_document_free(d);
|
|
89
89
|
leptris_xsd_free(s);
|
|
90
90
|
}
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
// ---- leptris-rs#45: union-typed fixed constraints compare in the
|
|
94
|
+
// union's VALUE SPACE — the first member type validating the fixed
|
|
95
|
+
// lexical must also validate the instance lexical (stE050: "1" and
|
|
96
|
+
// "true" both xs:boolean; stE055: "1.0"/"1.000" both xs:float).
|
|
97
|
+
// Raw strcmp wrongly rejected value-equal forms. Real W3C fixtures
|
|
98
|
+
// (msData/simpleType, vendored under libxml2-cases/stE-union-fixed).
|
|
99
|
+
TEST(XsdUnionFixed, StE050BooleanMemberAcceptsBoth) {
|
|
100
|
+
EXPECT_EQ(validate_case(cases_path("stE-union-fixed/stE050.xsd"),
|
|
101
|
+
cases_path("stE-union-fixed/stE050.xml")),
|
|
102
|
+
1);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
TEST(XsdUnionFixed, StE055FloatMemberAcceptsBothSpellings) {
|
|
106
|
+
EXPECT_EQ(validate_case(cases_path("stE-union-fixed/stE055.xsd"),
|
|
107
|
+
cases_path("stE-union-fixed/stE055.xml")),
|
|
108
|
+
1);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
TEST(XsdUnionFixed, NonMemberValueStillRejects) {
|
|
112
|
+
/* "2.0" validates through the union (float) but differs from the
|
|
113
|
+
* fixed 1.0 in the value space — the fixed constraint holds. */
|
|
114
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
115
|
+
LeptrisXsdSchema s = leptris_xsd_compile_file(
|
|
116
|
+
cases_path("stE-union-fixed/stE055.xsd").c_str(), &st);
|
|
117
|
+
ASSERT_NE(s, (LeptrisXsdSchema)0);
|
|
118
|
+
const char other[] = "<root>2.000</root>";
|
|
119
|
+
LeptrisDocument d = leptris_parse_string(other, strlen(other), &st);
|
|
120
|
+
ASSERT_NE(d, nullptr);
|
|
121
|
+
EXPECT_EQ(leptris_xsd_validate(s, d), 0)
|
|
122
|
+
<< "fixed 1.0 accepted the value 2.0";
|
|
123
|
+
leptris_document_free(d);
|
|
124
|
+
leptris_xsd_free(s);
|
|
125
|
+
}
|
|
@@ -1230,6 +1230,32 @@ int validate_doc(const char* schema, const char* xml) {
|
|
|
1230
1230
|
return r;
|
|
1231
1231
|
}
|
|
1232
1232
|
|
|
1233
|
+
// leptris#1964: the anyAttribute grammar rides attributeGroup
|
|
1234
|
+
// REFS too — attgD019's ##any wildcard lives inside the referenced
|
|
1235
|
+
// group, not the referencing complexType's direct children, so the
|
|
1236
|
+
// type's grammar captured empty and strict admission rejected
|
|
1237
|
+
// attributes the wildcard admits. compile-set variant: the head
|
|
1238
|
+
// (no tns) + the foo-tns member; W3C attgD019 expects VALID.
|
|
1239
|
+
TEST(XsdCompile, StrictAnyAttrGrammarRidesAttributeGroupRefs) {
|
|
1240
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
1241
|
+
const char* paths[] = {
|
|
1242
|
+
LEPTRIS_XSD_CASES_DIR "/attgD019-set/attgD019.xsd",
|
|
1243
|
+
LEPTRIS_XSD_CASES_DIR "/attgD019-set/attgD019a.xsd",
|
|
1244
|
+
};
|
|
1245
|
+
LeptrisXsdSchema s = leptris_xsd_compile_set(paths, 2, &st);
|
|
1246
|
+
ASSERT_NE(s, (LeptrisXsdSchema)0) << "status " << (int)st;
|
|
1247
|
+
const char inst[] =
|
|
1248
|
+
"<doc xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
|
|
1249
|
+
" xmlns:x=\"foo\">"
|
|
1250
|
+
"<elem att1=\"123\" x:foo=\"foo\"/></doc>";
|
|
1251
|
+
LeptrisDocument d = leptris_parse_string(inst, strlen(inst), &st);
|
|
1252
|
+
ASSERT_NE(d, nullptr);
|
|
1253
|
+
EXPECT_EQ(leptris_xsd_validate(s, d), 1)
|
|
1254
|
+
<< leptris_xsd_error_at(s, 0);
|
|
1255
|
+
leptris_document_free(d);
|
|
1256
|
+
leptris_xsd_free(s);
|
|
1257
|
+
}
|
|
1258
|
+
|
|
1233
1259
|
TEST(XsdValidate, ValidDocumentPasses) {
|
|
1234
1260
|
EXPECT_EQ(validate_doc(k_v_schema,
|
|
1235
1261
|
"<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.
|
|
4
|
+
"version": "1.9.408",
|
|
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.408.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
@@ -1281,6 +1281,8 @@ files:
|
|
|
1281
1281
|
- vendor-src/libleptris/test/xsd/libxml2-cases/anyAttr.importB.1_0.xsd
|
|
1282
1282
|
- vendor-src/libleptris/test/xsd/libxml2-cases/anyAttr1_0.xml
|
|
1283
1283
|
- vendor-src/libleptris/test/xsd/libxml2-cases/anyAttr1_0.xsd
|
|
1284
|
+
- vendor-src/libleptris/test/xsd/libxml2-cases/attgD019-set/attgD019.xsd
|
|
1285
|
+
- vendor-src/libleptris/test/xsd/libxml2-cases/attgD019-set/attgD019a.xsd
|
|
1284
1286
|
- vendor-src/libleptris/test/xsd/libxml2-cases/attr0_0.xml
|
|
1285
1287
|
- vendor-src/libleptris/test/xsd/libxml2-cases/attr0_0.xsd
|
|
1286
1288
|
- vendor-src/libleptris/test/xsd/libxml2-cases/attruse_0_0.xml
|
|
@@ -1586,6 +1588,10 @@ files:
|
|
|
1586
1588
|
- vendor-src/libleptris/test/xsd/libxml2-cases/src-element2-2_0.xsd
|
|
1587
1589
|
- vendor-src/libleptris/test/xsd/libxml2-cases/src-element3_0.xml
|
|
1588
1590
|
- vendor-src/libleptris/test/xsd/libxml2-cases/src-element3_0.xsd
|
|
1591
|
+
- vendor-src/libleptris/test/xsd/libxml2-cases/stE-union-fixed/stE050.xml
|
|
1592
|
+
- vendor-src/libleptris/test/xsd/libxml2-cases/stE-union-fixed/stE050.xsd
|
|
1593
|
+
- vendor-src/libleptris/test/xsd/libxml2-cases/stE-union-fixed/stE055.xml
|
|
1594
|
+
- vendor-src/libleptris/test/xsd/libxml2-cases/stE-union-fixed/stE055.xsd
|
|
1589
1595
|
- vendor-src/libleptris/test/xsd/libxml2-cases/subst-group-1_0.xsd
|
|
1590
1596
|
- vendor-src/libleptris/test/xsd/libxml2-cases/subst-group-1_1.xml
|
|
1591
1597
|
- vendor-src/libleptris/test/xsd/libxml2-cases/union2_1.xml
|