leptris 1.9.403.1-arm-linux → 1.9.405.0-arm-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 (77) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +1 -1
  3. data/ext/leptris/native/native.c +60 -0
  4. data/lib/leptris/version.rb +1 -1
  5. data/lib/leptris/xml/native.so +0 -0
  6. data/lib/leptris/xml/native_3_3.so +0 -0
  7. data/lib/libleptris.so +0 -0
  8. data/vendor-src/README.md +1 -1
  9. data/vendor-src/libleptris/CHANGELOG.md +147 -8
  10. data/vendor-src/libleptris/CMakeLists.txt +1 -1
  11. data/vendor-src/libleptris/src/leptris/descriptor/plan.c +98 -7
  12. data/vendor-src/libleptris/src/leptris/xsd/compile.c +200 -13
  13. data/vendor-src/libleptris/src/leptris/xsd/validate.c +133 -24
  14. data/vendor-src/libleptris/src/leptris/xsd/xsd_internal.h +15 -0
  15. data/vendor-src/libleptris/test/CMakeLists.txt +6 -0
  16. data/vendor-src/libleptris/test/abi/test_descriptor.cpp +232 -0
  17. data/vendor-src/libleptris/test/xsd/libxml2-cases/i1957/instance.xml +2 -0
  18. data/vendor-src/libleptris/test/xsd/libxml2-cases/i1957/schema.xsd +16 -0
  19. data/vendor-src/libleptris/test/xsd/libxml2-cases/i1958/schF1.xml +14 -0
  20. data/vendor-src/libleptris/test/xsd/libxml2-cases/i1958/schF1_a.xsd +28 -0
  21. data/vendor-src/libleptris/test/xsd/libxml2-cases/i1958/schF1_b.xsd +14 -0
  22. data/vendor-src/libleptris/test/xsd/libxml2-cases/i1958/schP2.xml +2 -0
  23. data/vendor-src/libleptris/test/xsd/libxml2-cases/i1958/schP2_a.xsd +27 -0
  24. data/vendor-src/libleptris/test/xsd/libxml2-cases/i1958/schP2_b.xsd +12 -0
  25. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_fixed_empty/isdefault005.xml +1 -0
  26. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_fixed_empty/isdefault005.xsd +9 -0
  27. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_list_default/stZ072.xml +1 -0
  28. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_list_default/stZ072.xsd +12 -0
  29. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_mixed_particleless/ctA033.xml +1 -0
  30. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_mixed_particleless/ctA033.xsd +4 -0
  31. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_redefine_ext/idF025.red +8 -0
  32. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_redefine_ext/idF025.xml +15 -0
  33. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_redefine_ext/idF025.xsd +30 -0
  34. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_redefine_ext/idF025_base.xsd +7 -0
  35. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/addB104.xml +6 -0
  36. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/addB104.xsd +19 -0
  37. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/attO006.xml +4 -0
  38. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/attO006.xsd +15 -0
  39. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/ctA033.xml +2 -0
  40. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/ctA033.xsd +5 -0
  41. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/ctA035.xml +2 -0
  42. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/ctA035.xsd +5 -0
  43. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idF025.red +8 -0
  44. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idF025.xml +15 -0
  45. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idF025.xsd +30 -0
  46. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idF033.xml +12 -0
  47. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idF033.xsd +23 -0
  48. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idF033a.xsd +8 -0
  49. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idF034.red +8 -0
  50. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idF034.xml +15 -0
  51. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idF034.xsd +30 -0
  52. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idG018.xml +12 -0
  53. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idG018.xsd +23 -0
  54. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idG018a.xsd +8 -0
  55. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idG019.red +8 -0
  56. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idG019.xml +15 -0
  57. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idG019.xsd +30 -0
  58. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idG027.xml +12 -0
  59. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idG027.xsd +23 -0
  60. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idG027a.xsd +8 -0
  61. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idG028.red +8 -0
  62. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idG028.xml +15 -0
  63. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/idG028.xsd +30 -0
  64. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/isdefault002.xsd +12 -0
  65. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/isdefault004.xsd +12 -0
  66. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/isdefault005.xml +5 -0
  67. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/isdefault006.xml +5 -0
  68. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/isdefault025.xml +5 -0
  69. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/isdefault026.xml +5 -0
  70. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/stZ072.xml +1 -0
  71. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/stZ072.xsd +20 -0
  72. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/test95960_1.xml +4 -0
  73. data/vendor-src/libleptris/test/xsd/libxml2-cases/rs35_w3c/test95960_1.xsd +12 -0
  74. data/vendor-src/libleptris/test/xsd/test_i1957_1958.cpp +90 -0
  75. data/vendor-src/libleptris/test/xsd/test_rs35_regression.cpp +127 -0
  76. data/vendor-src/libleptris/vcpkg.json +1 -1
  77. metadata +60 -1
@@ -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;
@@ -245,6 +255,11 @@ typedef struct xsd_element_ics {
245
255
  typedef struct xsd_attrgroup_def {
246
256
  char* name;
247
257
  XsdAttrDecl* attrs;
258
+ /* leptris#1957: the definition's own element — the ref
259
+ * expansion RE-CAPTURES it lazily so an inner attributeGroup ref
260
+ * naming a LATER-registered group resolves (document-order
261
+ * capture used to leave level-2 members unexpanded). */
262
+ LeptrisElement elem;
248
263
  struct xsd_attrgroup_def* next;
249
264
  } XsdAttrGroupDef;
250
265
 
@@ -153,6 +153,12 @@ 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")
159
+ leptris_add_test(test_i1957_1958 xsd/test_i1957_1958.cpp)
160
+ target_compile_definitions(test_i1957_1958 PRIVATE
161
+ LEPTRIS_XSD_CASES_DIR="${CMAKE_CURRENT_SOURCE_DIR}/xsd/libxml2-cases")
156
162
  target_compile_definitions(test_rng PRIVATE
157
163
  LEPTRIS_RNG_INCLUDE_DIR="${CMAKE_CURRENT_SOURCE_DIR}/rng/include-cases")
158
164
  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,2 @@
1
+ <doc xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2
+ xsi:noNamespaceSchemaLocation="schema.xsd" att1="x" foo="123">text</doc>
@@ -0,0 +1,16 @@
1
+ <?xml version="1.0"?>
2
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
3
+ <xsd:attribute name="att1" type="xsd:string"/>
4
+ <xsd:element name="doc">
5
+ <xsd:complexType mixed="true">
6
+ <xsd:attributeGroup ref="main"/>
7
+ </xsd:complexType>
8
+ </xsd:element>
9
+ <xsd:attributeGroup name="main">
10
+ <xsd:attribute ref="att1"/>
11
+ <xsd:attributeGroup ref="sub"/>
12
+ </xsd:attributeGroup>
13
+ <xsd:attributeGroup name="sub">
14
+ <xsd:attribute name="foo" type="xsd:int"/>
15
+ </xsd:attributeGroup>
16
+ </xsd:schema>
@@ -0,0 +1,14 @@
1
+ <a:root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2
+ xsi:schemaLocation="ns-a schF1_a.xsd"
3
+ xmlns:a="ns-a"
4
+ >
5
+ <a:e1>
6
+ <a:a1>123</a:a1>
7
+ <a:a2>true</a:a2>
8
+ </a:e1>
9
+ <e1>
10
+ <a1>true</a1>
11
+ <a2>123</a2>
12
+ </e1>
13
+
14
+ </a:root>
@@ -0,0 +1,28 @@
1
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
2
+ targetNamespace="ns-a"
3
+ xmlns:a="ns-a"
4
+ elementFormDefault="qualified"
5
+ >
6
+
7
+ <xsd:import schemaLocation="schF1_b.xsd"/>
8
+
9
+ <xsd:complexType name="ct-A">
10
+ <xsd:sequence minOccurs="1">
11
+ <xsd:element name="a1" type="xsd:int" />
12
+ <xsd:element name="a2" type="xsd:boolean" />
13
+ </xsd:sequence>
14
+ </xsd:complexType>
15
+
16
+ <xsd:element name="e1" type="a:ct-A" />
17
+
18
+ <xsd:element name="root">
19
+ <xsd:complexType>
20
+ <xsd:choice maxOccurs="unbounded">
21
+ <xsd:any namespace="##any" processContents="strict"/>
22
+ </xsd:choice>
23
+ </xsd:complexType>
24
+ </xsd:element>
25
+
26
+ </xsd:schema>
27
+
28
+
@@ -0,0 +1,14 @@
1
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
2
+ elementFormDefault="qualified"
3
+ >
4
+
5
+ <xsd:complexType name="ct-A">
6
+ <xsd:sequence minOccurs="1">
7
+ <xsd:element name="a1" type="xsd:boolean" />
8
+ <xsd:element name="a2" type="xsd:int" />
9
+ </xsd:sequence>
10
+ </xsd:complexType>
11
+
12
+ <xsd:element name="e1" type="ct-A" />
13
+
14
+ </xsd:schema>
@@ -0,0 +1,2 @@
1
+ <?xml version="1.0"?>
2
+ <e1 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="ns-a" xsi:schemaLocation="ns-a schP2_a.xsd">abcd</e1>
@@ -0,0 +1,27 @@
1
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
2
+ targetNamespace="ns-a"
3
+ xmlns="ns-a"
4
+ elementFormDefault="qualified"
5
+ >
6
+
7
+ <xsd:redefine schemaLocation="schP2_b.xsd">
8
+ <xsd:simpleType name="b-st">
9
+ <xsd:restriction base="b-st">
10
+ <xsd:minLength value="4"/>
11
+ </xsd:restriction>
12
+ </xsd:simpleType>
13
+ </xsd:redefine>
14
+
15
+ <xsd:element name="e1" type="b-st" />
16
+
17
+ <xsd:element name="root">
18
+ <xsd:complexType>
19
+ <xsd:choice maxOccurs="unbounded">
20
+ <xsd:any namespace="##any" processContents="strict"/>
21
+ </xsd:choice>
22
+ </xsd:complexType>
23
+ </xsd:element>
24
+
25
+ </xsd:schema>
26
+
27
+
@@ -0,0 +1,12 @@
1
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
2
+ targetNamespace="ns-a"
3
+ xmlns="ns-a"
4
+ elementFormDefault="qualified"
5
+ >
6
+ <xsd:simpleType name="b-st">
7
+ <xsd:restriction base="xsd:string"/>
8
+ </xsd:simpleType>
9
+
10
+ <xsd:element name="b-e1" type="b-st" />
11
+
12
+ </xsd:schema>
@@ -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,4 @@
1
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
2
+ <xsd:complexType name="fooType" mixed="true"/>
3
+ <xsd:element name="root" type="fooType"/>
4
+ </xsd:schema>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0"?>
2
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
3
+ <xsd:complexType name="tabletype">
4
+ <xsd:sequence>
5
+ <xsd:element name="r" type="xsd:string"/>
6
+ </xsd:sequence>
7
+ </xsd:complexType>
8
+ </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,7 @@
1
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
2
+ <xsd:complexType name="tabletype">
3
+ <xsd:sequence>
4
+ <xsd:element name="caption" type="xsd:string"/>
5
+ </xsd:sequence>
6
+ </xsd:complexType>
7
+ </xsd:schema>
@@ -0,0 +1,6 @@
1
+ <x:doc
2
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
+ xmlns:x="ns"
4
+ xsi:schemaLocation="ns addB104.xsd">
5
+ <x:elem x:att=" 123 " />
6
+ </x:doc>
@@ -0,0 +1,19 @@
1
+ <?xml version="1.0"?>
2
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
3
+ targetNamespace="ns"
4
+ xmlns:x='ns'
5
+ elementFormDefault="qualified"
6
+ attributeFormDefault="qualified">
7
+
8
+ <xsd:element name="doc">
9
+ <xsd:complexType>
10
+ <xsd:choice>
11
+ <xsd:element name="elem" >
12
+ <xsd:complexType>
13
+ <xsd:attribute name="att" type="xsd:integer" fixed=" 123 "/>
14
+ </xsd:complexType>
15
+ </xsd:element>
16
+ </xsd:choice>
17
+ </xsd:complexType>
18
+ </xsd:element>
19
+ </xsd:schema>
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0"?>
2
+ <x:doc xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:x="http://xsdtesting" xsi:schemaLocation="http://xsdtesting attO006.xsd">
3
+ <x:elem x:att="123 "/>
4
+ </x:doc>
@@ -0,0 +1,15 @@
1
+ <?xml version="1.0"?>
2
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://xsdtesting" xmlns:x="http://xsdtesting" elementFormDefault="qualified" attributeFormDefault="qualified">
3
+ <xsd:element name="doc">
4
+ <xsd:complexType>
5
+ <xsd:choice>
6
+ <xsd:element name="elem">
7
+ <xsd:complexType>
8
+ <xsd:attribute name="att" type="xsd:integer" fixed=" 123 ">
9
+ </xsd:attribute>
10
+ </xsd:complexType>
11
+ </xsd:element>
12
+ </xsd:choice>
13
+ </xsd:complexType>
14
+ </xsd:element>
15
+ </xsd:schema>
@@ -0,0 +1,2 @@
1
+ <?xml version="1.0"?>
2
+ <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ctA033.xsd">test</root>
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0"?>
2
+ <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
3
+ <xs:complexType name="fooType" mixed="true"/>
4
+ <xs:element name="root" type="fooType"/>
5
+ </xs:schema>
@@ -0,0 +1,2 @@
1
+ <?xml version="1.0"?>
2
+ <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ctA035.xsd">test</root>
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0"?>
2
+ <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
3
+ <xs:complexType name="fooType" mixed="1"/>
4
+ <xs:element name="root" type="fooType"/>
5
+ </xs:schema>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0"?>
2
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
3
+ <xsd:complexType name="tabletype">
4
+ <xsd:sequence>
5
+ <xsd:element name="r" type="xsd:string"/>
6
+ </xsd:sequence>
7
+ </xsd:complexType>
8
+ </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>