leptris 1.9.403.0-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.
- checksums.yaml +4 -4
- data/Rakefile +18 -1
- data/ext/leptris/native/extconf.rb +6 -0
- data/ext/leptris/native/native.c +28 -7
- data/lib/leptris/version.rb +1 -1
- data/lib/leptris/xml/descriptor.rb +12 -3
- data/lib/leptris/xml/native.so +0 -0
- data/lib/leptris/xml/native_3_3.so +0 -0
- data/lib/libleptris.so +0 -0
- data/vendor-src/README.md +1 -1
- data/vendor-src/libleptris/CHANGELOG.md +109 -8
- data/vendor-src/libleptris/CMakeLists.txt +1 -1
- data/vendor-src/libleptris/src/leptris/descriptor/plan.c +98 -7
- data/vendor-src/libleptris/src/leptris/xsd/compile.c +20 -0
- data/vendor-src/libleptris/src/leptris/xsd/validate.c +40 -16
- data/vendor-src/libleptris/src/leptris/xsd/xsd_internal.h +10 -0
- data/vendor-src/libleptris/test/CMakeLists.txt +3 -0
- data/vendor-src/libleptris/test/abi/test_descriptor.cpp +232 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_fixed_empty/isdefault005.xml +1 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_fixed_empty/isdefault005.xsd +9 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_list_default/stZ072.xml +1 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_list_default/stZ072.xsd +12 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_mixed_particleless/ctA033.xml +1 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_mixed_particleless/ctA033.xsd +4 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_redefine_ext/idF025.red +8 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_redefine_ext/idF025.xml +15 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_redefine_ext/idF025.xsd +30 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_redefine_ext/idF025_base.xsd +7 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/ctA033.xml +2 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/ctA033.xsd +5 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/ctA035.xml +2 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/ctA035.xsd +5 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idF025.red +8 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idF025.xml +15 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idF025.xsd +30 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idF033.xml +12 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idF033.xsd +23 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idF033a.xsd +8 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idF034.red +8 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idF034.xml +15 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idF034.xsd +30 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idG018.xml +12 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idG018.xsd +23 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idG018a.xsd +8 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idG019.red +8 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idG019.xml +15 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idG019.xsd +30 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idG027.xml +12 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idG027.xsd +23 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idG027a.xsd +8 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idG028.red +8 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idG028.xml +15 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idG028.xsd +30 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/isdefault002.xsd +12 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/isdefault004.xsd +12 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/isdefault005.xml +5 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/isdefault006.xml +5 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/isdefault025.xml +5 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/isdefault026.xml +5 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/stZ072.xml +1 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/stZ072.xsd +20 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/test95960_1.xml +4 -0
- data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/test95960_1.xsd +12 -0
- data/vendor-src/libleptris/test/xsd/test_rs35_regression.cpp +116 -0
- data/vendor-src/libleptris/vcpkg.json +1 -1
- metadata +47 -1
|
@@ -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
|
-
|
|
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
|
-
|
|
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 (
|
|
843
|
-
|
|
844
|
-
|
|
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)
|
|
@@ -2403,6 +2403,238 @@ TEST(Plan408, ResultBuildFeedsSerialize) {
|
|
|
2403
2403
|
leptris_plan_free(plan);
|
|
2404
2404
|
}
|
|
2405
2405
|
|
|
2406
|
+
// ---- leptris#1941: the ops builder carries emission bindings ----
|
|
2407
|
+
// The walk stamps (ns_prefix, ns_uri) onto values (#1551); the ops
|
|
2408
|
+
// builder skipped them — the root, scalar rows, and attribute rows
|
|
2409
|
+
// all spelled bare names with no xmlns declarations, so every
|
|
2410
|
+
// namespaced native-emission tree serialized unnamespaced.
|
|
2411
|
+
|
|
2412
|
+
TEST(Plan1941, ResultBuildCarriesRootRowAndAttrBindings) {
|
|
2413
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
2414
|
+
leptris_child_plan kids[1] = {};
|
|
2415
|
+
kids[0].wire_name = "p";
|
|
2416
|
+
kids[0].kind = LEPTRIS_PLAN_KIND_SCALAR;
|
|
2417
|
+
kids[0].child_plan_index = -1;
|
|
2418
|
+
kids[0].ns_form = LEPTRIS_PLAN_NS_EXACT;
|
|
2419
|
+
kids[0].ns_uri = "http://example.com/wml";
|
|
2420
|
+
kids[0].ns_prefix = "w";
|
|
2421
|
+
|
|
2422
|
+
leptris_attr_plan attrs[1] = {};
|
|
2423
|
+
attrs[0].wire_name = "name";
|
|
2424
|
+
attrs[0].kind = LEPTRIS_PLAN_KIND_SCALAR;
|
|
2425
|
+
attrs[0].ns_form = LEPTRIS_PLAN_NS_EXACT;
|
|
2426
|
+
attrs[0].ns_uri = "http://example.com/wml";
|
|
2427
|
+
attrs[0].ns_prefix = "w";
|
|
2428
|
+
|
|
2429
|
+
leptris_element_plan plans[1] = {};
|
|
2430
|
+
plans[0].element_name = "document";
|
|
2431
|
+
plans[0].ns_form = LEPTRIS_PLAN_NS_EXACT;
|
|
2432
|
+
plans[0].ns_uri = "http://example.com/wml";
|
|
2433
|
+
plans[0].ns_prefix = "w";
|
|
2434
|
+
plans[0].attribute_count = 1;
|
|
2435
|
+
plans[0].attribute_plans = attrs;
|
|
2436
|
+
plans[0].child_count = 1;
|
|
2437
|
+
plans[0].child_plans = kids;
|
|
2438
|
+
|
|
2439
|
+
leptris_plan_spec spec = {};
|
|
2440
|
+
spec.abi_version = leptris_plan_abi_version();
|
|
2441
|
+
spec.plan_count = 1;
|
|
2442
|
+
spec.plans = plans;
|
|
2443
|
+
LeptrisPlan plan = leptris_plan_build(&spec, &st);
|
|
2444
|
+
ASSERT_NE(plan, nullptr);
|
|
2445
|
+
|
|
2446
|
+
leptris_plan_row_op ops[] = {
|
|
2447
|
+
{LEPTRIS_PLAN_OP_ELEMENT, 0, UINT32_MAX, NULL, NULL, 0},
|
|
2448
|
+
{LEPTRIS_PLAN_OP_ATTR, 0, 0, "name", "d1", 2},
|
|
2449
|
+
{LEPTRIS_PLAN_OP_SCALAR, 0, 0, NULL, "alpha", 5},
|
|
2450
|
+
{LEPTRIS_PLAN_OP_END, 0, UINT32_MAX, NULL, NULL, 0},
|
|
2451
|
+
};
|
|
2452
|
+
LeptrisPlanResult r = leptris_plan_result_build(plan, ops, 4, &st);
|
|
2453
|
+
ASSERT_NE(r, nullptr);
|
|
2454
|
+
char* out = leptris_plan_serialize(plan, r, &st);
|
|
2455
|
+
ASSERT_NE(out, nullptr);
|
|
2456
|
+
EXPECT_STREQ(out,
|
|
2457
|
+
"<w:document xmlns:w=\"http://example.com/wml\" "
|
|
2458
|
+
"w:name=\"d1\"><w:p>alpha</w:p></w:document>");
|
|
2459
|
+
leptris_free_string(out);
|
|
2460
|
+
leptris_plan_result_free(r);
|
|
2461
|
+
leptris_plan_free(plan);
|
|
2462
|
+
}
|
|
2463
|
+
|
|
2464
|
+
/* A row spelling a prefix without its own ns_uri inherits the
|
|
2465
|
+
* TARGET plan's URI (the walk's #1115 fallback): the compiler
|
|
2466
|
+
* leaves inherited rows' ns unset and the prefix comes from the
|
|
2467
|
+
* child plan's tree namespace. */
|
|
2468
|
+
TEST(Plan1941, ResultBuildInheritsTargetUriForPrefixOnlyRows) {
|
|
2469
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
2470
|
+
leptris_child_plan root_kids[1] = {};
|
|
2471
|
+
root_kids[0].wire_name = "docId";
|
|
2472
|
+
root_kids[0].kind = LEPTRIS_PLAN_KIND_NESTED;
|
|
2473
|
+
root_kids[0].child_plan_index = 1;
|
|
2474
|
+
root_kids[0].ns_prefix = "w14";
|
|
2475
|
+
|
|
2476
|
+
leptris_element_plan plans[2] = {};
|
|
2477
|
+
plans[0].element_name = "settings";
|
|
2478
|
+
plans[0].ns_form = LEPTRIS_PLAN_NS_EXACT;
|
|
2479
|
+
plans[0].ns_uri = "http://example.com/main";
|
|
2480
|
+
plans[0].ns_prefix = "w";
|
|
2481
|
+
plans[0].child_count = 1;
|
|
2482
|
+
plans[0].child_plans = root_kids;
|
|
2483
|
+
plans[1].element_name = "docId";
|
|
2484
|
+
plans[1].ns_form = LEPTRIS_PLAN_NS_EXACT;
|
|
2485
|
+
plans[1].ns_uri = "http://example.com/w14";
|
|
2486
|
+
plans[1].ns_prefix = "w14";
|
|
2487
|
+
|
|
2488
|
+
leptris_plan_spec spec = {};
|
|
2489
|
+
spec.abi_version = leptris_plan_abi_version();
|
|
2490
|
+
spec.plan_count = 2;
|
|
2491
|
+
spec.plans = plans;
|
|
2492
|
+
LeptrisPlan plan = leptris_plan_build(&spec, &st);
|
|
2493
|
+
ASSERT_NE(plan, nullptr);
|
|
2494
|
+
|
|
2495
|
+
leptris_plan_row_op ops[] = {
|
|
2496
|
+
{LEPTRIS_PLAN_OP_ELEMENT, 0, UINT32_MAX, NULL, NULL, 0},
|
|
2497
|
+
{LEPTRIS_PLAN_OP_ELEMENT, 0, 0, NULL, NULL, 0},
|
|
2498
|
+
{LEPTRIS_PLAN_OP_END, 0, UINT32_MAX, NULL, NULL, 0},
|
|
2499
|
+
{LEPTRIS_PLAN_OP_END, 0, UINT32_MAX, NULL, NULL, 0},
|
|
2500
|
+
};
|
|
2501
|
+
LeptrisPlanResult r = leptris_plan_result_build(plan, ops, 4, &st);
|
|
2502
|
+
ASSERT_NE(r, nullptr);
|
|
2503
|
+
char* out = leptris_plan_serialize(plan, r, &st);
|
|
2504
|
+
ASSERT_NE(out, nullptr);
|
|
2505
|
+
EXPECT_STREQ(out,
|
|
2506
|
+
"<w:settings xmlns:w=\"http://example.com/main\" "
|
|
2507
|
+
"xmlns:w14=\"http://example.com/w14\">"
|
|
2508
|
+
"<w14:docId/></w:settings>");
|
|
2509
|
+
leptris_free_string(out);
|
|
2510
|
+
leptris_plan_result_free(r);
|
|
2511
|
+
leptris_plan_free(plan);
|
|
2512
|
+
}
|
|
2513
|
+
|
|
2514
|
+
/* leptris#1941 emission inheritance, two rules (the DOM lane's
|
|
2515
|
+
* Namespaces planner contract): (1) rows of a namespaced plan
|
|
2516
|
+
* inherit that plan's binding — an explicit row binding wins;
|
|
2517
|
+
* (2) a NESTED row inherits the CHILD plan's binding so the
|
|
2518
|
+
* wrapper spells the child's namespace, not the parent's. */
|
|
2519
|
+
TEST(Plan1941, ResultBuildInheritsPlanAndChildPlanBindings) {
|
|
2520
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
2521
|
+
/* plan 0: settings (w) with a nested row "body" -> plan 1;
|
|
2522
|
+
* plan 1: body (w) with a scalar row "t" (no row binding). */
|
|
2523
|
+
leptris_child_plan root_kids[1] = {};
|
|
2524
|
+
root_kids[0].wire_name = "body";
|
|
2525
|
+
root_kids[0].kind = LEPTRIS_PLAN_KIND_NESTED;
|
|
2526
|
+
root_kids[0].child_plan_index = 1;
|
|
2527
|
+
|
|
2528
|
+
leptris_child_plan body_kids[1] = {};
|
|
2529
|
+
body_kids[0].wire_name = "t";
|
|
2530
|
+
body_kids[0].kind = LEPTRIS_PLAN_KIND_SCALAR;
|
|
2531
|
+
body_kids[0].child_plan_index = -1;
|
|
2532
|
+
|
|
2533
|
+
leptris_element_plan plans[2] = {};
|
|
2534
|
+
plans[0].element_name = "settings";
|
|
2535
|
+
plans[0].ns_form = LEPTRIS_PLAN_NS_EXACT;
|
|
2536
|
+
plans[0].ns_uri = "http://example.com/main";
|
|
2537
|
+
plans[0].ns_prefix = "w";
|
|
2538
|
+
plans[0].child_count = 1;
|
|
2539
|
+
plans[0].child_plans = root_kids;
|
|
2540
|
+
plans[1].element_name = "body";
|
|
2541
|
+
plans[1].ns_form = LEPTRIS_PLAN_NS_EXACT;
|
|
2542
|
+
plans[1].ns_uri = "http://example.com/main";
|
|
2543
|
+
plans[1].ns_prefix = "w";
|
|
2544
|
+
plans[1].child_count = 1;
|
|
2545
|
+
plans[1].child_plans = body_kids;
|
|
2546
|
+
|
|
2547
|
+
leptris_plan_spec spec = {};
|
|
2548
|
+
spec.abi_version = leptris_plan_abi_version();
|
|
2549
|
+
spec.plan_count = 2;
|
|
2550
|
+
spec.plans = plans;
|
|
2551
|
+
LeptrisPlan plan = leptris_plan_build(&spec, &st);
|
|
2552
|
+
ASSERT_NE(plan, nullptr);
|
|
2553
|
+
|
|
2554
|
+
leptris_plan_row_op ops[] = {
|
|
2555
|
+
{LEPTRIS_PLAN_OP_ELEMENT, 0, UINT32_MAX, NULL, NULL, 0},
|
|
2556
|
+
{LEPTRIS_PLAN_OP_ELEMENT, 0, 0, NULL, NULL, 0},
|
|
2557
|
+
{LEPTRIS_PLAN_OP_SCALAR, 1, 0, NULL, "hello", 5},
|
|
2558
|
+
{LEPTRIS_PLAN_OP_END, 0, UINT32_MAX, NULL, NULL, 0},
|
|
2559
|
+
{LEPTRIS_PLAN_OP_END, 0, UINT32_MAX, NULL, NULL, 0},
|
|
2560
|
+
};
|
|
2561
|
+
LeptrisPlanResult r = leptris_plan_result_build(plan, ops, 5, &st);
|
|
2562
|
+
ASSERT_NE(r, nullptr);
|
|
2563
|
+
char* out = leptris_plan_serialize(plan, r, &st);
|
|
2564
|
+
ASSERT_NE(out, nullptr);
|
|
2565
|
+
/* The nested row spells the CHILD plan's prefix; the scalar
|
|
2566
|
+
* row inherits its OWN plan's prefix; one declaration per
|
|
2567
|
+
* distinct pair on the root. */
|
|
2568
|
+
EXPECT_STREQ(out,
|
|
2569
|
+
"<w:settings xmlns:w=\"http://example.com/main\">"
|
|
2570
|
+
"<w:body><w:t>hello</w:t></w:body></w:settings>");
|
|
2571
|
+
leptris_free_string(out);
|
|
2572
|
+
leptris_plan_result_free(r);
|
|
2573
|
+
leptris_plan_free(plan);
|
|
2574
|
+
}
|
|
2575
|
+
|
|
2576
|
+
/* Explicit row bindings beat inherited ones: the docId rows of
|
|
2577
|
+
* the #1115 multi-ns case carry no row binding and take the
|
|
2578
|
+
* child plan's w14/w15 namespaces, while a row WITH a binding
|
|
2579
|
+
* keeps it verbatim. */
|
|
2580
|
+
TEST(Plan1941, ResultBuildExplicitRowBindingBeatsInheritance) {
|
|
2581
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
2582
|
+
leptris_child_plan root_kids[2] = {};
|
|
2583
|
+
root_kids[0].wire_name = "docId";
|
|
2584
|
+
root_kids[0].kind = LEPTRIS_PLAN_KIND_NESTED;
|
|
2585
|
+
root_kids[0].child_plan_index = 1;
|
|
2586
|
+
root_kids[1].wire_name = "note";
|
|
2587
|
+
root_kids[1].kind = LEPTRIS_PLAN_KIND_NESTED;
|
|
2588
|
+
root_kids[1].child_plan_index = 2;
|
|
2589
|
+
root_kids[1].ns_form = LEPTRIS_PLAN_NS_EXACT;
|
|
2590
|
+
root_kids[1].ns_uri = "http://example.com/other";
|
|
2591
|
+
root_kids[1].ns_prefix = "o";
|
|
2592
|
+
|
|
2593
|
+
leptris_element_plan plans[3] = {};
|
|
2594
|
+
plans[0].element_name = "settings";
|
|
2595
|
+
plans[0].ns_form = LEPTRIS_PLAN_NS_EXACT;
|
|
2596
|
+
plans[0].ns_uri = "http://example.com/main";
|
|
2597
|
+
plans[0].ns_prefix = "w";
|
|
2598
|
+
plans[0].child_count = 2;
|
|
2599
|
+
plans[0].child_plans = root_kids;
|
|
2600
|
+
plans[1].element_name = "docId";
|
|
2601
|
+
plans[1].ns_form = LEPTRIS_PLAN_NS_EXACT;
|
|
2602
|
+
plans[1].ns_uri = "http://example.com/w14";
|
|
2603
|
+
plans[1].ns_prefix = "w14";
|
|
2604
|
+
plans[2].element_name = "note";
|
|
2605
|
+
plans[2].ns_form = LEPTRIS_PLAN_NS_EXACT;
|
|
2606
|
+
plans[2].ns_uri = "http://example.com/other";
|
|
2607
|
+
plans[2].ns_prefix = "o";
|
|
2608
|
+
|
|
2609
|
+
leptris_plan_spec spec = {};
|
|
2610
|
+
spec.abi_version = leptris_plan_abi_version();
|
|
2611
|
+
spec.plan_count = 3;
|
|
2612
|
+
spec.plans = plans;
|
|
2613
|
+
LeptrisPlan plan = leptris_plan_build(&spec, &st);
|
|
2614
|
+
ASSERT_NE(plan, nullptr);
|
|
2615
|
+
|
|
2616
|
+
leptris_plan_row_op ops[] = {
|
|
2617
|
+
{LEPTRIS_PLAN_OP_ELEMENT, 0, UINT32_MAX, NULL, NULL, 0},
|
|
2618
|
+
{LEPTRIS_PLAN_OP_ELEMENT, 0, 0, NULL, NULL, 0},
|
|
2619
|
+
{LEPTRIS_PLAN_OP_END, 0, UINT32_MAX, NULL, NULL, 0},
|
|
2620
|
+
{LEPTRIS_PLAN_OP_ELEMENT, 0, 1, NULL, NULL, 0},
|
|
2621
|
+
{LEPTRIS_PLAN_OP_END, 0, UINT32_MAX, NULL, NULL, 0},
|
|
2622
|
+
{LEPTRIS_PLAN_OP_END, 0, UINT32_MAX, NULL, NULL, 0},
|
|
2623
|
+
};
|
|
2624
|
+
LeptrisPlanResult r = leptris_plan_result_build(plan, ops, 6, &st);
|
|
2625
|
+
ASSERT_NE(r, nullptr);
|
|
2626
|
+
char* out = leptris_plan_serialize(plan, r, &st);
|
|
2627
|
+
ASSERT_NE(out, nullptr);
|
|
2628
|
+
EXPECT_STREQ(out,
|
|
2629
|
+
"<w:settings xmlns:w=\"http://example.com/main\" "
|
|
2630
|
+
"xmlns:w14=\"http://example.com/w14\" "
|
|
2631
|
+
"xmlns:o=\"http://example.com/other\">"
|
|
2632
|
+
"<w14:docId/><o:note/></w:settings>");
|
|
2633
|
+
leptris_free_string(out);
|
|
2634
|
+
leptris_plan_result_free(r);
|
|
2635
|
+
leptris_plan_free(plan);
|
|
2636
|
+
}
|
|
2637
|
+
|
|
2406
2638
|
TEST(Plan408, ResultBuildRejectsBadPrograms) {
|
|
2407
2639
|
LeptrisStatus st = LEPTRIS_OK;
|
|
2408
2640
|
leptris_element_plan plans[1] = {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<root><number/><bool/></root>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
|
2
|
+
<xsd:complexType name="t">
|
|
3
|
+
<xsd:sequence>
|
|
4
|
+
<xsd:element name="number" type="xsd:integer" fixed="123"/>
|
|
5
|
+
<xsd:element name="bool" type="xsd:boolean" fixed="true"/>
|
|
6
|
+
</xsd:sequence>
|
|
7
|
+
</xsd:complexType>
|
|
8
|
+
<xsd:element name="root" type="t"/>
|
|
9
|
+
</xsd:schema>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
|
2
|
+
<xsd:simpleType name="mylist">
|
|
3
|
+
<xsd:restriction>
|
|
4
|
+
<xsd:simpleType>
|
|
5
|
+
<xsd:list itemType="xsd:integer"/>
|
|
6
|
+
</xsd:simpleType>
|
|
7
|
+
<xsd:enumeration value="1"/>
|
|
8
|
+
<xsd:enumeration value="2"/>
|
|
9
|
+
</xsd:restriction>
|
|
10
|
+
</xsd:simpleType>
|
|
11
|
+
<xsd:element name="root" type="mylist" default="1"/>
|
|
12
|
+
</xsd:schema>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<root>test</root>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<?xml version="1.0"?>
|
|
2
|
+
<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="idF025.xsd">
|
|
3
|
+
<t>
|
|
4
|
+
<r> 1 </r>
|
|
5
|
+
<c val="1"> 1 </c>
|
|
6
|
+
</t>
|
|
7
|
+
<t>
|
|
8
|
+
<r> 2 </r>
|
|
9
|
+
<c val="2"> 2 </c>
|
|
10
|
+
</t>
|
|
11
|
+
<t>
|
|
12
|
+
<r> 3 </r>
|
|
13
|
+
<c val="3"> 3 </c>
|
|
14
|
+
</t>
|
|
15
|
+
</root>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<?xml version="1.0"?>
|
|
2
|
+
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
|
3
|
+
<xsd:redefine schemaLocation="idF025.red">
|
|
4
|
+
<xsd:complexType name="tabletype">
|
|
5
|
+
<xsd:complexContent>
|
|
6
|
+
<xsd:extension base="tabletype">
|
|
7
|
+
<xsd:sequence>
|
|
8
|
+
<xsd:element name="c">
|
|
9
|
+
<xsd:complexType mixed="true">
|
|
10
|
+
<xsd:attribute name="val" type="xsd:string"/>
|
|
11
|
+
</xsd:complexType>
|
|
12
|
+
</xsd:element>
|
|
13
|
+
</xsd:sequence>
|
|
14
|
+
</xsd:extension>
|
|
15
|
+
</xsd:complexContent>
|
|
16
|
+
</xsd:complexType>
|
|
17
|
+
</xsd:redefine>
|
|
18
|
+
<xsd:element name="root">
|
|
19
|
+
<xsd:complexType>
|
|
20
|
+
<xsd:sequence>
|
|
21
|
+
<xsd:element ref="t" maxOccurs="unbounded"/>
|
|
22
|
+
</xsd:sequence>
|
|
23
|
+
</xsd:complexType>
|
|
24
|
+
<xsd:unique name="tableu">
|
|
25
|
+
<xsd:selector xpath=".//t/c"/>
|
|
26
|
+
<xsd:field xpath="@val"/>
|
|
27
|
+
</xsd:unique>
|
|
28
|
+
</xsd:element>
|
|
29
|
+
<xsd:element name="t" type="tabletype"/>
|
|
30
|
+
</xsd:schema>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<?xml version="1.0"?>
|
|
2
|
+
<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="idF025.xsd">
|
|
3
|
+
<t>
|
|
4
|
+
<r> 1 </r>
|
|
5
|
+
<c val="1"> 1 </c>
|
|
6
|
+
</t>
|
|
7
|
+
<t>
|
|
8
|
+
<r> 2 </r>
|
|
9
|
+
<c val="2"> 2 </c>
|
|
10
|
+
</t>
|
|
11
|
+
<t>
|
|
12
|
+
<r> 3 </r>
|
|
13
|
+
<c val="3"> 3 </c>
|
|
14
|
+
</t>
|
|
15
|
+
</root>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<?xml version="1.0"?>
|
|
2
|
+
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
|
3
|
+
<xsd:redefine schemaLocation="idF025.red">
|
|
4
|
+
<xsd:complexType name="tabletype">
|
|
5
|
+
<xsd:complexContent>
|
|
6
|
+
<xsd:extension base="tabletype">
|
|
7
|
+
<xsd:sequence>
|
|
8
|
+
<xsd:element name="c">
|
|
9
|
+
<xsd:complexType mixed="true">
|
|
10
|
+
<xsd:attribute name="val" type="xsd:string"/>
|
|
11
|
+
</xsd:complexType>
|
|
12
|
+
</xsd:element>
|
|
13
|
+
</xsd:sequence>
|
|
14
|
+
</xsd:extension>
|
|
15
|
+
</xsd:complexContent>
|
|
16
|
+
</xsd:complexType>
|
|
17
|
+
</xsd:redefine>
|
|
18
|
+
<xsd:element name="root">
|
|
19
|
+
<xsd:complexType>
|
|
20
|
+
<xsd:sequence>
|
|
21
|
+
<xsd:element ref="t" maxOccurs="unbounded"/>
|
|
22
|
+
</xsd:sequence>
|
|
23
|
+
</xsd:complexType>
|
|
24
|
+
<xsd:unique name="tableu">
|
|
25
|
+
<xsd:selector xpath=".//t/c"/>
|
|
26
|
+
<xsd:field xpath="@val"/>
|
|
27
|
+
</xsd:unique>
|
|
28
|
+
</xsd:element>
|
|
29
|
+
<xsd:element name="t" type="tabletype"/>
|
|
30
|
+
</xsd:schema>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<?xml version="1.0"?>
|
|
2
|
+
<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="idF033.xsd" xmlns:import="importNS">
|
|
3
|
+
<t val="1">
|
|
4
|
+
<import:r val2="a"> 1 </import:r>
|
|
5
|
+
</t>
|
|
6
|
+
<t val="2">
|
|
7
|
+
<import:r val2="b"> 2 </import:r>
|
|
8
|
+
</t>
|
|
9
|
+
<t val="3">
|
|
10
|
+
<import:r val2="c"> 3 </import:r>
|
|
11
|
+
</t>
|
|
12
|
+
</root>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<?xml version="1.0"?>
|
|
2
|
+
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:import="importNS">
|
|
3
|
+
<xsd:import namespace="importNS" schemaLocation="idF033a.xsd"/>
|
|
4
|
+
<xsd:element name="root">
|
|
5
|
+
<xsd:complexType>
|
|
6
|
+
<xsd:sequence>
|
|
7
|
+
<xsd:element ref="t" maxOccurs="unbounded"/>
|
|
8
|
+
</xsd:sequence>
|
|
9
|
+
</xsd:complexType>
|
|
10
|
+
<xsd:unique name="tableu">
|
|
11
|
+
<xsd:selector xpath=".//t/import:r"/>
|
|
12
|
+
<xsd:field xpath="@import:val2"/>
|
|
13
|
+
</xsd:unique>
|
|
14
|
+
</xsd:element>
|
|
15
|
+
<xsd:element name="t">
|
|
16
|
+
<xsd:complexType>
|
|
17
|
+
<xsd:sequence>
|
|
18
|
+
<xsd:element ref="import:r"/>
|
|
19
|
+
</xsd:sequence>
|
|
20
|
+
<xsd:attribute name="val" type="xsd:string"/>
|
|
21
|
+
</xsd:complexType>
|
|
22
|
+
</xsd:element>
|
|
23
|
+
</xsd:schema>
|