leptris 1.9.232.0-arm-linux → 1.9.237.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +25 -0
- data/Rakefile +1 -1
- data/ext/leptris/native/native.c +144 -3
- data/lib/leptris/version.rb +1 -1
- data/lib/leptris/xml/document.rb +20 -3
- data/lib/leptris/xml/ffi.rb +91 -62
- data/lib/leptris/xml/native.so +0 -0
- data/lib/libleptris.so +0 -0
- data/vendor-src/README.md +1 -1
- data/vendor-src/libleptris/CHANGELOG.md +113 -4
- data/vendor-src/libleptris/CMakeLists.txt +1 -1
- data/vendor-src/libleptris/benchmarks/dom/bench_leptris.c +14 -6
- data/vendor-src/libleptris/src/include/leptris.h +27 -0
- data/vendor-src/libleptris/src/leptris/dom/element_modify.c +20 -0
- data/vendor-src/libleptris/src/leptris/leptris_internal.h +5 -0
- data/vendor-src/libleptris/src/leptris/xpath/evaluator.c +7 -0
- data/vendor-src/libleptris/src/leptris/xpath/evaluator_operators.c +38 -4
- data/vendor-src/libleptris/src/leptris/xpath/evaluator_types.c +5 -1
- data/vendor-src/libleptris/src/leptris/xpath/functions.c +86 -7
- data/vendor-src/libleptris/src/leptris/xpath/functions_ext31.c +237 -24
- data/vendor-src/libleptris/src/leptris/xpath/xpath_public.c +16 -1
- data/vendor-src/libleptris/test/dom/test_dom.cpp +80 -0
- data/vendor-src/libleptris/test/xquery/qt3/fn/count.xml +3117 -0
- data/vendor-src/libleptris/test/xquery/qt3/fn/empty.xml +502 -0
- data/vendor-src/libleptris/test/xquery/qt3/fn/exists.xml +537 -0
- data/vendor-src/libleptris/test/xquery/qt3/fn/head.xml +90 -0
- data/vendor-src/libleptris/test/xquery/qt3/fn/tail.xml +68 -0
- data/vendor-src/libleptris/test/xquery/test_qt3.cpp +124 -93
- data/vendor-src/libleptris/test/xquery/test_xquery.cpp +28 -0
- data/vendor-src/libleptris/vcpkg.json +1 -1
- metadata +6 -1
|
@@ -397,7 +397,11 @@ LEPTRIS_API const char* leptris_xpath_result_node_value(
|
|
|
397
397
|
* per-member type checks — never show it to public
|
|
398
398
|
* consumers. */
|
|
399
399
|
if (text->content && text->content[0] == '\x03' &&
|
|
400
|
-
text->content[1] == 'N'
|
|
400
|
+
(text->content[1] == 'N' || text->content[1] == 'B' ||
|
|
401
|
+
text->content[1] == 'D' ||
|
|
402
|
+
(text->content[1] == 'F' &&
|
|
403
|
+
!((text->content[2] == 'N' && text->content[3] == '\x02') ||
|
|
404
|
+
text->content[2] == 'R'))))
|
|
401
405
|
return text->content + 2;
|
|
402
406
|
return text->content;
|
|
403
407
|
}
|
|
@@ -415,6 +419,17 @@ LEPTRIS_API int leptris_xpath_result_boolean(LeptrisXPathResult result) {
|
|
|
415
419
|
case XPATH_RESULT_STRING:
|
|
416
420
|
return (result->value.string_value && result->value.string_value[0] != '\0') ? 1 : 0;
|
|
417
421
|
case XPATH_RESULT_NODESET:
|
|
422
|
+
if (result->value.nodeset_value &&
|
|
423
|
+
result->value.nodeset_value->count == 1) {
|
|
424
|
+
void* nd = result->value.nodeset_value->nodes[0];
|
|
425
|
+
if (nd && (int)XPATH_NODE_TYPE(nd) == (int)LEPTRIS_NODE_TEXT) {
|
|
426
|
+
XPathTextNode* tn = (XPathTextNode*)nd;
|
|
427
|
+
/* "\x03B" boolean members carry their EBV */
|
|
428
|
+
if (tn->content && tn->content[0] == '\x03' &&
|
|
429
|
+
tn->content[1] == 'B')
|
|
430
|
+
return tn->content[2] == 't';
|
|
431
|
+
}
|
|
432
|
+
}
|
|
418
433
|
return (result->value.nodeset_value && result->value.nodeset_value->count > 0) ? 1 : 0;
|
|
419
434
|
default:
|
|
420
435
|
return 0;
|
|
@@ -2616,3 +2616,83 @@ TEST(AttributePairs, BulkReadReturnsNamesValuesAndHandles) {
|
|
|
2616
2616
|
0u);
|
|
2617
2617
|
leptris_document_free(doc);
|
|
2618
2618
|
}
|
|
2619
|
+
|
|
2620
|
+
/* #1344: single-crossing element construction — the fused
|
|
2621
|
+
* create + N x set_attribute entry for builder paths. */
|
|
2622
|
+
TEST(ElementNewWithAttributes, CreatesElementWithAllAttributes) {
|
|
2623
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
2624
|
+
LeptrisDocument doc = leptris_parse_string("<r/>", 4, &st);
|
|
2625
|
+
ASSERT_NE(doc, nullptr);
|
|
2626
|
+
const char* names[] = {"id", "class"};
|
|
2627
|
+
const char* values[] = {"7", "c"};
|
|
2628
|
+
LeptrisElement e = leptris_element_new_with_attributes(
|
|
2629
|
+
doc, "book", names, values, 2);
|
|
2630
|
+
ASSERT_NE(e, nullptr);
|
|
2631
|
+
EXPECT_STREQ(leptris_element_name(e), "book");
|
|
2632
|
+
EXPECT_EQ(leptris_element_attribute_count(e), 2u);
|
|
2633
|
+
EXPECT_STREQ(leptris_element_attribute(e, "id"), "7");
|
|
2634
|
+
EXPECT_STREQ(leptris_element_attribute(e, "class"), "c");
|
|
2635
|
+
leptris_document_free(doc);
|
|
2636
|
+
}
|
|
2637
|
+
|
|
2638
|
+
TEST(ElementNewWithAttributes, ZeroAttributesMakesPlainElement) {
|
|
2639
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
2640
|
+
LeptrisDocument doc = leptris_parse_string("<r/>", 4, &st);
|
|
2641
|
+
ASSERT_NE(doc, nullptr);
|
|
2642
|
+
LeptrisElement e = leptris_element_new_with_attributes(doc, "leaf",
|
|
2643
|
+
NULL, NULL, 0);
|
|
2644
|
+
ASSERT_NE(e, nullptr);
|
|
2645
|
+
EXPECT_STREQ(leptris_element_name(e), "leaf");
|
|
2646
|
+
EXPECT_EQ(leptris_element_attribute_count(e), 0u);
|
|
2647
|
+
leptris_document_free(doc);
|
|
2648
|
+
}
|
|
2649
|
+
|
|
2650
|
+
TEST(ElementNewWithAttributes, InvalidArgsReturnNull) {
|
|
2651
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
2652
|
+
LeptrisDocument doc = leptris_parse_string("<r/>", 4, &st);
|
|
2653
|
+
ASSERT_NE(doc, nullptr);
|
|
2654
|
+
const char* names[] = {"id"};
|
|
2655
|
+
const char* values[] = {"1"};
|
|
2656
|
+
EXPECT_EQ(leptris_element_new_with_attributes(NULL, "a", names,
|
|
2657
|
+
values, 1),
|
|
2658
|
+
nullptr);
|
|
2659
|
+
EXPECT_EQ(leptris_element_new_with_attributes(doc, NULL, names,
|
|
2660
|
+
values, 1),
|
|
2661
|
+
nullptr);
|
|
2662
|
+
EXPECT_EQ(leptris_element_new_with_attributes(doc, "a", NULL, values,
|
|
2663
|
+
1),
|
|
2664
|
+
nullptr);
|
|
2665
|
+
leptris_document_free(doc);
|
|
2666
|
+
}
|
|
2667
|
+
|
|
2668
|
+
TEST(ElementNewWithAttributes, SerializesLikeSetAttributePath) {
|
|
2669
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
2670
|
+
LeptrisDocument doc = leptris_parse_string("<r/>", 4, &st);
|
|
2671
|
+
ASSERT_NE(doc, nullptr);
|
|
2672
|
+
const char* names[] = {"id"};
|
|
2673
|
+
const char* values[] = {"x&y"};
|
|
2674
|
+
LeptrisElement e = leptris_element_new_with_attributes(
|
|
2675
|
+
doc, "n", names, values, 1);
|
|
2676
|
+
ASSERT_NE(e, nullptr);
|
|
2677
|
+
LeptrisElement root = leptris_document_root(doc);
|
|
2678
|
+
ASSERT_EQ(leptris_element_append_child(root, e), LEPTRIS_OK);
|
|
2679
|
+
char* xml = leptris_document_serialize(doc, nullptr);
|
|
2680
|
+
ASSERT_NE(xml, nullptr);
|
|
2681
|
+
EXPECT_STREQ(xml, "<r><n id=\"x&y\"/></r>");
|
|
2682
|
+
leptris_free_string(xml);
|
|
2683
|
+
leptris_document_free(doc);
|
|
2684
|
+
}
|
|
2685
|
+
|
|
2686
|
+
TEST(ElementNewWithAttributes, DuplicateNamesReplaceLastWins) {
|
|
2687
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
2688
|
+
LeptrisDocument doc = leptris_parse_string("<r/>", 4, &st);
|
|
2689
|
+
ASSERT_NE(doc, nullptr);
|
|
2690
|
+
const char* names[] = {"id", "id"};
|
|
2691
|
+
const char* values[] = {"first", "second"};
|
|
2692
|
+
LeptrisElement e = leptris_element_new_with_attributes(
|
|
2693
|
+
doc, "n", names, values, 2);
|
|
2694
|
+
ASSERT_NE(e, nullptr);
|
|
2695
|
+
EXPECT_EQ(leptris_element_attribute_count(e), 1u);
|
|
2696
|
+
EXPECT_STREQ(leptris_element_attribute(e, "id"), "second");
|
|
2697
|
+
leptris_document_free(doc);
|
|
2698
|
+
}
|