leptris 1.9.402.0-arm-linux → 1.9.403.1-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/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 +15 -0
- data/vendor-src/libleptris/CMakeLists.txt +1 -1
- data/vendor-src/libleptris/src/leptris/rng/rng_regex.c +200 -40
- data/vendor-src/libleptris/src/leptris/xsd/compile.c +54 -7
- data/vendor-src/libleptris/src/leptris/xsd/datatypes.c +166 -4
- data/vendor-src/libleptris/src/leptris/xsd/validate.c +87 -15
- data/vendor-src/libleptris/src/leptris/xsd/xsd_internal.h +1 -1
- data/vendor-src/libleptris/test/xsd/test_xsd_compile.cpp +522 -0
- data/vendor-src/libleptris/vcpkg.json +1 -1
- metadata +2 -2
|
@@ -492,6 +492,322 @@ TEST(XsdDatatypes, DigitClassPinsLegacyNd) {
|
|
|
492
492
|
leptris_xsd_free(s);
|
|
493
493
|
}
|
|
494
494
|
|
|
495
|
+
// W3C XSD suite msData/regex reG21/reG23 (+ reG-class): an
|
|
496
|
+
// IN-CLASS negated builtin (\D, \C, \W, \S) is the complement of
|
|
497
|
+
// the builtin unioned with the class's other members. The old
|
|
498
|
+
// in-class path uppercased the escape into cls_add_builtin (only
|
|
499
|
+
// the lowercase cases exist), built an EMPTY member set, and the
|
|
500
|
+
// "complement" memset accepted every byte: [\D]+ matched '1'.
|
|
501
|
+
TEST(XsdDatatypes, ClassNegatedBuiltinsComplement) {
|
|
502
|
+
const char xsd[] =
|
|
503
|
+
"<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">"
|
|
504
|
+
"<xs:simpleType name=\"NonDigClass\"><xs:restriction"
|
|
505
|
+
" base=\"xs:string\">"
|
|
506
|
+
"<xs:pattern value=\"[\\D]+\"/></xs:restriction></xs:simpleType>"
|
|
507
|
+
"<xs:simpleType name=\"reG23\"><xs:restriction"
|
|
508
|
+
" base=\"xs:string\">"
|
|
509
|
+
"<xs:pattern value=\"[\\D\\?a-c\\?]+\"/></xs:restriction>"
|
|
510
|
+
"</xs:simpleType>"
|
|
511
|
+
"<xs:simpleType name=\"reG21\"><xs:restriction"
|
|
512
|
+
" base=\"xs:string\">"
|
|
513
|
+
"<xs:pattern value=\"[\\C\\?a-c\\?]+\"/></xs:restriction>"
|
|
514
|
+
"</xs:simpleType>"
|
|
515
|
+
"<xs:simpleType name=\"SpaceClass\"><xs:restriction"
|
|
516
|
+
" base=\"xs:string\">"
|
|
517
|
+
"<xs:pattern value=\"[\\S]+\"/></xs:restriction></xs:simpleType>"
|
|
518
|
+
"<xs:simpleType name=\"NonWordClass\"><xs:restriction"
|
|
519
|
+
" base=\"xs:string\">"
|
|
520
|
+
"<xs:pattern value=\"[\\W]+\"/></xs:restriction></xs:simpleType>"
|
|
521
|
+
"</xs:schema>";
|
|
522
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
523
|
+
LeptrisXsdSchema s = leptris_xsd_compile(xsd, strlen(xsd), &st);
|
|
524
|
+
ASSERT_EQ(st, LEPTRIS_OK);
|
|
525
|
+
ASSERT_NE(s, (LeptrisXsdSchema)0);
|
|
526
|
+
/* [\D]+ : digits reject, everything else (incl. astral-adjacent
|
|
527
|
+
* unicode) accepts */
|
|
528
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "NonDigClass", "1"), 0);
|
|
529
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "NonDigClass", "9"), 0);
|
|
530
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "NonDigClass", "x"), 1);
|
|
531
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "NonDigClass", "?"), 1);
|
|
532
|
+
/* the legacy-Nd pin: U+1369 is a DIGIT, \D must reject */
|
|
533
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "NonDigClass",
|
|
534
|
+
"\xE1\x8D\xA9"), 0);
|
|
535
|
+
/* reG23 [\\D\\?a-c\\?]+ : suite value '?1?' [invalid] */
|
|
536
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "reG23", "?1?"), 0);
|
|
537
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "reG23", "?d?"), 1);
|
|
538
|
+
/* reG21 [\\C\\?a-c\\?]+ : suite value '?d?' [invalid] — 'd'
|
|
539
|
+
* is a NameChar, \\C excludes it; '?a?' accepts (a in a-c) */
|
|
540
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "reG21", "?d?"), 0);
|
|
541
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "reG21", "?a?"), 1);
|
|
542
|
+
/* [\\S]+ : whitespace rejects */
|
|
543
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "SpaceClass", " "), 0);
|
|
544
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "SpaceClass", "a"), 1);
|
|
545
|
+
/* [\\W]+ : punctuation accepts, word chars reject */
|
|
546
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "NonWordClass", "!"), 1);
|
|
547
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "NonWordClass", "a"), 0);
|
|
548
|
+
leptris_xsd_free(s);
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
// W3C XSD suite msData/regex reG26-33/reH19 (F.1 productions
|
|
552
|
+
// [14]/[17]-[22]): an unescaped '-' is a character range member
|
|
553
|
+
// only at the BEGINNING or END of a positive character group. A
|
|
554
|
+
// '-' after a completed member with a following non-']' char is a
|
|
555
|
+
// grammar error — the SCHEMA must fail to compile (suite
|
|
556
|
+
// schemaTest: invalid; xmllint is lenient here, the suite governs).
|
|
557
|
+
TEST(XsdDatatypes, DashAfterRangeMemberIsGrammarError) {
|
|
558
|
+
auto compile_pattern = [](const char* pat) {
|
|
559
|
+
char buf[512];
|
|
560
|
+
snprintf(buf, sizeof(buf),
|
|
561
|
+
"<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">"
|
|
562
|
+
"<xs:simpleType name=\"t\"><xs:restriction"
|
|
563
|
+
" base=\"xs:string\">"
|
|
564
|
+
"<xs:pattern value=\"%s\"/></xs:restriction>"
|
|
565
|
+
"</xs:simpleType></xs:schema>", pat);
|
|
566
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
567
|
+
LeptrisXsdSchema s = leptris_xsd_compile(
|
|
568
|
+
buf, strlen(buf), &st);
|
|
569
|
+
int err = st != LEPTRIS_OK ||
|
|
570
|
+
leptris_xsd_error(s) != NULL;
|
|
571
|
+
leptris_xsd_free(s);
|
|
572
|
+
return !err;
|
|
573
|
+
};
|
|
574
|
+
// reG26-33: dash after a completed range, mid-group
|
|
575
|
+
EXPECT_EQ(compile_pattern("[a-c-1-4x-z-7-9]*"), 0);
|
|
576
|
+
// reH19: [a-a-x-x]+ — dash after the a-a range
|
|
577
|
+
EXPECT_EQ(compile_pattern("[a-a-x-x]+"), 0);
|
|
578
|
+
// dash mid-group after a plain member
|
|
579
|
+
EXPECT_EQ(compile_pattern("[a-b-c]"), 0);
|
|
580
|
+
// the LEGAL shapes stay legal: dash first, dash last, escaped
|
|
581
|
+
EXPECT_EQ(compile_pattern("[-abc]"), 1);
|
|
582
|
+
EXPECT_EQ(compile_pattern("[abc-]"), 1);
|
|
583
|
+
EXPECT_EQ(compile_pattern("[a\\-b]"), 1);
|
|
584
|
+
EXPECT_EQ(compile_pattern("[0-9-]"), 1);
|
|
585
|
+
EXPECT_EQ(compile_pattern("[^abc]"), 1);
|
|
586
|
+
// reG17: [\\-\\{^] — the escaped-brace range end compiles
|
|
587
|
+
EXPECT_EQ(compile_pattern("[\\\\-\\{^]"), 1);
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
// F.1 [7] quantMin "{n,}" is OPEN-ENDED (the {n}-exact fix clobbered
|
|
591
|
+
// it: after the comma branch *q is at '}', so "{n,}" collapsed to
|
|
592
|
+
// {n,n}) and [2] branch ::= piece* — an EMPTY branch is legal and
|
|
593
|
+
// matches only "" (reE10: the pattern "|" is valid; reC57:
|
|
594
|
+
// (ab){2,}).
|
|
595
|
+
TEST(XsdDatatypes, OpenEndedRepeatAndEmptyBranch) {
|
|
596
|
+
const char xsd[] =
|
|
597
|
+
"<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">"
|
|
598
|
+
"<xs:simpleType name=\"rep\"><xs:restriction base=\"xs:string\">"
|
|
599
|
+
"<xs:pattern value=\"a{2,}\"/></xs:restriction></xs:simpleType>"
|
|
600
|
+
"<xs:simpleType name=\"grp\"><xs:restriction base=\"xs:string\">"
|
|
601
|
+
"<xs:pattern value=\"(ab){2,}\"/></xs:restriction>"
|
|
602
|
+
"</xs:simpleType>"
|
|
603
|
+
"<xs:simpleType name=\"alt\"><xs:restriction base=\"xs:string\">"
|
|
604
|
+
"<xs:pattern value=\"|\"/></xs:restriction></xs:simpleType>"
|
|
605
|
+
"<xs:simpleType name=\"altL\"><xs:restriction base=\"xs:string\">"
|
|
606
|
+
"<xs:pattern value=\"a|\"/></xs:restriction></xs:simpleType>"
|
|
607
|
+
"<xs:simpleType name=\"altR\"><xs:restriction base=\"xs:string\">"
|
|
608
|
+
"<xs:pattern value=\"|b\"/></xs:restriction></xs:simpleType>"
|
|
609
|
+
"</xs:schema>";
|
|
610
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
611
|
+
LeptrisXsdSchema s = leptris_xsd_compile(xsd, strlen(xsd), &st);
|
|
612
|
+
ASSERT_EQ(st, LEPTRIS_OK);
|
|
613
|
+
ASSERT_NE(s, (LeptrisXsdSchema)0);
|
|
614
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "rep", "aaa"), 1);
|
|
615
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "rep", "aa"), 1);
|
|
616
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "rep", "a"), 0);
|
|
617
|
+
/* reC57: (ab){2,} vs 'ababab' [valid] */
|
|
618
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "grp", "ababab"), 1);
|
|
619
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "grp", "abab"), 1);
|
|
620
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "grp", "ab"), 0);
|
|
621
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "grp", "aba"), 0);
|
|
622
|
+
/* reE10: "|" matches only the empty string */
|
|
623
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "alt", ""), 1);
|
|
624
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "alt", "a"), 0);
|
|
625
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "altL", "a"), 1);
|
|
626
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "altL", ""), 1);
|
|
627
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "altL", "b"), 0);
|
|
628
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "altR", "b"), 1);
|
|
629
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "altR", ""), 1);
|
|
630
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "altR", "a"), 0);
|
|
631
|
+
leptris_xsd_free(s);
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
// reD3-6: a REP over a nullable body — the count loop must not end
|
|
635
|
+
// at the body's EMPTY first alternative while later alternatives
|
|
636
|
+
// consume ((a?|b)+ 'b'; the full reD3 shape 'woman1y').
|
|
637
|
+
TEST(XsdDatatypes, RepOverNullableBodyBacktracksToConsumingAlt) {
|
|
638
|
+
const char xsd[] =
|
|
639
|
+
"<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">"
|
|
640
|
+
"<xs:simpleType name=\"d3\"><xs:restriction base=\"xs:string\">"
|
|
641
|
+
"<xs:pattern value=\"(((((boy)|(girl))[0-1][x-z]{2})?)|"
|
|
642
|
+
"(man|woman)[0-1]?[y|n])*\"/></xs:restriction>"
|
|
643
|
+
"</xs:simpleType>"
|
|
644
|
+
"<xs:simpleType name=\"red\"><xs:restriction base=\"xs:string\">"
|
|
645
|
+
"<xs:pattern value=\"(a?|b)+\"/></xs:restriction>"
|
|
646
|
+
"</xs:simpleType></xs:schema>";
|
|
647
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
648
|
+
LeptrisXsdSchema s = leptris_xsd_compile(xsd, strlen(xsd), &st);
|
|
649
|
+
ASSERT_EQ(st, LEPTRIS_OK);
|
|
650
|
+
ASSERT_NE(s, (LeptrisXsdSchema)0);
|
|
651
|
+
/* reD3: suite value 'woman1y' [valid] */
|
|
652
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "d3", "woman1y"), 1);
|
|
653
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "d3", "boy0xy"), 1);
|
|
654
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "d3", "man1n"), 1);
|
|
655
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "d3", "z"), 0);
|
|
656
|
+
/* reduction: each iteration must find the consuming alt */
|
|
657
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "red", "b"), 1);
|
|
658
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "red", "bb"), 1);
|
|
659
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "red", "ab"), 1);
|
|
660
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "red", "c"), 0);
|
|
661
|
+
leptris_xsd_free(s);
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
// reZ003-006: an IN-CLASS positive [\w] carries the complement
|
|
665
|
+
// form — \w is NOT(P|Z|C), so [\w] accepts Sm/Sc/No/letters
|
|
666
|
+
// (U+2044, U+00B2, U+00E9, '<') and REJECTS punctuation
|
|
667
|
+
// ('[', '<' is Sm -> accept; '[' is Ps -> reject). The positive
|
|
668
|
+
// merge copied tmp's P|Z|C mask WITHOUT cat_neg, inverting the
|
|
669
|
+
// class: [\w] accepted punctuation and rejected word symbols.
|
|
670
|
+
TEST(XsdDatatypes, InClassWordComplementCarriesNeg) {
|
|
671
|
+
const char xsd[] =
|
|
672
|
+
"<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">"
|
|
673
|
+
"<xs:simpleType name=\"wc\"><xs:restriction base=\"xs:string\">"
|
|
674
|
+
"<xs:pattern value=\"[\\w]\"/></xs:restriction></xs:simpleType>"
|
|
675
|
+
"<xs:simpleType name=\"wcd\"><xs:restriction base=\"xs:string\">"
|
|
676
|
+
"<xs:pattern value=\"[\\w\\d]+\"/></xs:restriction>"
|
|
677
|
+
"</xs:simpleType>"
|
|
678
|
+
"<xs:simpleType name=\"mail\"><xs:restriction base=\"xs:string\">"
|
|
679
|
+
"<xs:pattern value=\"[\\w\\-\\.]+@.*\"/></xs:restriction>"
|
|
680
|
+
"</xs:simpleType></xs:schema>";
|
|
681
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
682
|
+
LeptrisXsdSchema s = leptris_xsd_compile(xsd, strlen(xsd), &st);
|
|
683
|
+
ASSERT_EQ(st, LEPTRIS_OK);
|
|
684
|
+
ASSERT_NE(s, (LeptrisXsdSchema)0);
|
|
685
|
+
/* word chars: letters, digits, and the P/Z/C-excluded symbols */
|
|
686
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "wc", "a"), 1);
|
|
687
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "wc", "5"), 1);
|
|
688
|
+
#ifdef LEPTRIS_HAS_UTF8PROC
|
|
689
|
+
/* non-ASCII word chars need the category table; the no-utf8proc
|
|
690
|
+
* build degrades \w to the ASCII byte set */
|
|
691
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "wc",
|
|
692
|
+
"\xC3\xA9"), 1); /* U+00E9 Ll */
|
|
693
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "wc",
|
|
694
|
+
"\xE1\x8D\xA9"), 1); /* U+1369 */
|
|
695
|
+
#endif
|
|
696
|
+
/* punctuation is NOT a word char — and per the F.1 table \w
|
|
697
|
+
* excludes ALL of P (Pc too): '_' is NOT a word char (reZ002:
|
|
698
|
+
* the first_last email must fail [\w\-\.]+@.*) */
|
|
699
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "wc", "["), 0);
|
|
700
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "wc", ","), 0);
|
|
701
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "wc", " "), 0);
|
|
702
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "wc", "_"), 0);
|
|
703
|
+
/* [\w\d]: the digit member unions into the complement form */
|
|
704
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "wcd", "a5"), 1);
|
|
705
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "wcd", ","), 0);
|
|
706
|
+
/* reZ002's email shape: escaped dash/dot members still accept */
|
|
707
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "mail", "a.b-c@d"), 1);
|
|
708
|
+
leptris_xsd_free(s);
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
// reZ004-006: the in-class builtin merge must carry tmp's UNI
|
|
712
|
+
// ranges (the \d legacy-Nd pin U+1369) and the XML 1.0
|
|
713
|
+
// explicit-list chars: U+212E (BaseChar in the XML Letter
|
|
714
|
+
// production; So in modern tables) for \i/\c, and U+06DD
|
|
715
|
+
// (CombiningChar: Mn in Unicode 3.1, demoted to Cf in 4.0.1 —
|
|
716
|
+
// the same vintage demotion as the 1369-1371 digit pin) for \c.
|
|
717
|
+
TEST(XsdDatatypes, InClassBuiltinsCarryUniRangesAndXmlPins) {
|
|
718
|
+
const char xsd[] =
|
|
719
|
+
"<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">"
|
|
720
|
+
"<xs:simpleType name=\"d\"><xs:restriction base=\"xs:string\">"
|
|
721
|
+
"<xs:pattern value=\"[\\d]\"/></xs:restriction></xs:simpleType>"
|
|
722
|
+
"<xs:simpleType name=\"i\"><xs:restriction base=\"xs:string\">"
|
|
723
|
+
"<xs:pattern value=\"[\\i]\"/></xs:restriction></xs:simpleType>"
|
|
724
|
+
"<xs:simpleType name=\"c\"><xs:restriction base=\"xs:string\">"
|
|
725
|
+
"<xs:pattern value=\"[\\c]\"/></xs:restriction></xs:simpleType>"
|
|
726
|
+
"<xs:simpleType name=\"cs\"><xs:restriction base=\"xs:string\">"
|
|
727
|
+
"<xs:pattern value=\"[\\c]+\"/></xs:restriction></xs:simpleType>"
|
|
728
|
+
"</xs:schema>";
|
|
729
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
730
|
+
LeptrisXsdSchema s = leptris_xsd_compile(xsd, strlen(xsd), &st);
|
|
731
|
+
ASSERT_EQ(st, LEPTRIS_OK);
|
|
732
|
+
ASSERT_NE(s, (LeptrisXsdSchema)0);
|
|
733
|
+
/* reZ004v: [\d] accepts the legacy-Nd pin IN-CLASS */
|
|
734
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "d",
|
|
735
|
+
"\xE1\x8D\xA9"), 1); /* U+1369 */
|
|
736
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "d", "5"), 1);
|
|
737
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "d", "x"), 0);
|
|
738
|
+
/* reZ005v: [\i] accepts U+212E ESTIMATE SIGN */
|
|
739
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "i",
|
|
740
|
+
"\xE2\x84\xAE"), 1);
|
|
741
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "i", "a"), 1);
|
|
742
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "i", "5"), 0);
|
|
743
|
+
/* reZ006v: [\c] accepts U+212E, U+06DD, and the Extender
|
|
744
|
+
* production's explicit Po members U+00B7/U+0387 */
|
|
745
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "c",
|
|
746
|
+
"\xE2\x84\xAE"), 1);
|
|
747
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "c",
|
|
748
|
+
"\xDB\x9D"), 1); /* U+06DD */
|
|
749
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "c",
|
|
750
|
+
"\xC2\xB7"), 1); /* U+00B7 */
|
|
751
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "c",
|
|
752
|
+
"\xCE\x87"), 1); /* U+0387 */
|
|
753
|
+
/* [\c]+ runs the name-char set across a name */
|
|
754
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "cs", "a5.:-_"), 1);
|
|
755
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "cs", "!"), 0);
|
|
756
|
+
/* [\c] alone matches exactly one char */
|
|
757
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "c", "a"), 1);
|
|
758
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "c", "a5"), 0);
|
|
759
|
+
leptris_xsd_free(s);
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
// reF39: `[a-z-[^a]]` = {a} (a-z minus complement-of-a) — 'a'
|
|
763
|
+
// accepts, 'b' rejects. The subtraction branch must win over the
|
|
764
|
+
// range read: a single-char member followed by `-[` is
|
|
765
|
+
// charClassSub, not a range toward '[' (F.1 [16]).
|
|
766
|
+
TEST(XsdDatatypes, SubtractionOfNegatedClass) {
|
|
767
|
+
const char xsd[] =
|
|
768
|
+
"<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">"
|
|
769
|
+
"<xs:simpleType name=\"f39\"><xs:restriction base=\"xs:string\">"
|
|
770
|
+
"<xs:pattern value=\"[a-z-[^a]]\"/></xs:restriction>"
|
|
771
|
+
"</xs:simpleType>"
|
|
772
|
+
"<xs:simpleType name=\"sub1\"><xs:restriction base=\"xs:string\">"
|
|
773
|
+
"<xs:pattern value=\"[a-[b]]\"/></xs:restriction></xs:simpleType>"
|
|
774
|
+
"</xs:schema>";
|
|
775
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
776
|
+
LeptrisXsdSchema s = leptris_xsd_compile(xsd, strlen(xsd), &st);
|
|
777
|
+
ASSERT_EQ(st, LEPTRIS_OK);
|
|
778
|
+
ASSERT_NE(s, (LeptrisXsdSchema)0);
|
|
779
|
+
/* reF39: suite value 'b' [invalid], 'a' valid */
|
|
780
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "f39", "a"), 1);
|
|
781
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "f39", "b"), 0);
|
|
782
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "f39", "z"), 0);
|
|
783
|
+
/* single-char member followed by subtraction */
|
|
784
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "sub1", "a"), 1);
|
|
785
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "sub1", "b"), 0);
|
|
786
|
+
leptris_xsd_free(s);
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
// RegexTest_430: [^cde-[ag]] = complement({c,d,e}) minus {a,g} —
|
|
790
|
+
// the subtraction applies to the NEGATED GROUP's set, so 'a'/'g'
|
|
791
|
+
// are excluded even though they are outside the raw {c,d,e}
|
|
792
|
+
// bitmap (value 'agbfxyzga' [invalid]: 'a' is not matchable).
|
|
793
|
+
TEST(XsdDatatypes, SubtractionAppliesToNegatedGroup) {
|
|
794
|
+
const char xsd[] =
|
|
795
|
+
"<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">"
|
|
796
|
+
"<xs:simpleType name=\"t430\"><xs:restriction base=\"xs:string\">"
|
|
797
|
+
"<xs:pattern value=\"[^cde-[ag]]+\"/></xs:restriction>"
|
|
798
|
+
"</xs:simpleType></xs:schema>";
|
|
799
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
800
|
+
LeptrisXsdSchema s = leptris_xsd_compile(xsd, strlen(xsd), &st);
|
|
801
|
+
ASSERT_EQ(st, LEPTRIS_OK);
|
|
802
|
+
ASSERT_NE(s, (LeptrisXsdSchema)0);
|
|
803
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "t430", "bfxyz"), 1);
|
|
804
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "t430", "agbfxyzga"), 0);
|
|
805
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "t430", "a"), 0);
|
|
806
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "t430", "g"), 0);
|
|
807
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "t430", "c"), 0);
|
|
808
|
+
leptris_xsd_free(s);
|
|
809
|
+
}
|
|
810
|
+
|
|
495
811
|
TEST(XsdDatatypes, PatternPropertyClassesAndSubtraction) {
|
|
496
812
|
// The OPC ST_ContentType shape, minus the quoted-string member
|
|
497
813
|
// (same property-class + subtraction machinery): type/subtype
|
|
@@ -614,7 +930,13 @@ TEST(XsdDatatypes, BuiltinTableConvergesOnPart2) {
|
|
|
614
930
|
{"xs:duration", "P200.5Y", 0},
|
|
615
931
|
{"xs:base64Binary", "abcde", 0},
|
|
616
932
|
{"xs:QName", "xmlns:xsi", 0},
|
|
933
|
+
/* leptris-rs#28 (errE002): nonNegativeInteger allows an
|
|
934
|
+
* OPTIONAL sign where zero may carry '-' (XSD §3.3.20) */
|
|
935
|
+
{"xs:nonNegativeInteger", "-1", 0},
|
|
617
936
|
/* the valid twins stay valid */
|
|
937
|
+
{"xs:nonNegativeInteger", "+0", 1},
|
|
938
|
+
{"xs:nonNegativeInteger", "-0", 1},
|
|
939
|
+
{"xs:nonNegativeInteger", "00", 1},
|
|
618
940
|
{"xs:long", "9223372036854775807", 1},
|
|
619
941
|
{"xs:date", "2000-02-29", 1},
|
|
620
942
|
{"xs:time", "23:59:60", 1}, /* leap second */
|
|
@@ -676,6 +998,28 @@ TEST(XsdDatatypes, RestrictionFacetsApply) {
|
|
|
676
998
|
leptris_xsd_free(s);
|
|
677
999
|
}
|
|
678
1000
|
|
|
1001
|
+
// W3C XSD suite msData/regex/p16: two patterns in one restriction
|
|
1002
|
+
// are a DISJUNCTION — the lexical matches if ANY pattern matches
|
|
1003
|
+
// ("should be same as [abc]+|[123]+", value "112233123" [valid]).
|
|
1004
|
+
// Last-pattern-wins under-accepts every earlier pattern.
|
|
1005
|
+
TEST(XsdDatatypes, MultiplePatternsAreDisjunction) {
|
|
1006
|
+
const char* xsd =
|
|
1007
|
+
"<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">"
|
|
1008
|
+
"<xs:simpleType name=\"p16\">"
|
|
1009
|
+
"<xs:restriction base=\"xs:string\">"
|
|
1010
|
+
"<xs:pattern value=\"[123]+\"/>"
|
|
1011
|
+
"<xs:pattern value=\"[abc]+\"/>"
|
|
1012
|
+
"</xs:restriction></xs:simpleType>"
|
|
1013
|
+
"</xs:schema>";
|
|
1014
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
1015
|
+
LeptrisXsdSchema s = leptris_xsd_compile(xsd, strlen(xsd), &st);
|
|
1016
|
+
ASSERT_NE(s, (LeptrisXsdSchema)0);
|
|
1017
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "p16", "112233123"), 1);
|
|
1018
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "p16", "abc"), 1);
|
|
1019
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "p16", "x9"), 0);
|
|
1020
|
+
leptris_xsd_free(s);
|
|
1021
|
+
}
|
|
1022
|
+
|
|
679
1023
|
TEST(XsdDatatypes, LocalBaseChainValidatesEveryHop) {
|
|
680
1024
|
const char* xsd =
|
|
681
1025
|
"<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">"
|
|
@@ -934,6 +1278,163 @@ TEST(XsdValidate, AllMinOccursZeroAbsentWithRequiredParticles) {
|
|
|
934
1278
|
sch, "<root><elt1><elt2/></elt1></root>"), 0);
|
|
935
1279
|
}
|
|
936
1280
|
|
|
1281
|
+
// W3C XSD suite msData/regex/reG17: a simple-typed element's EMPTY
|
|
1282
|
+
// content is still a lexical value — "" must face the pattern facet
|
|
1283
|
+
// and the builtin path alike (xmllint: '' fails [a-z]+ and
|
|
1284
|
+
// xs:integer; whitespace-only and self-closing shapes too). The
|
|
1285
|
+
// `text && *text` guard silently accepted every empty simple-typed
|
|
1286
|
+
// element.
|
|
1287
|
+
TEST(XsdValidate, EmptyContentFacesSimpleTypeFacets) {
|
|
1288
|
+
const char* sch =
|
|
1289
|
+
"<xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">"
|
|
1290
|
+
"<xsd:element name=\"doc\"><xsd:complexType>"
|
|
1291
|
+
"<xsd:choice maxOccurs=\"unbounded\">"
|
|
1292
|
+
"<xsd:element name=\"e\" type=\"xsd:integer\"/>"
|
|
1293
|
+
"<xsd:element name=\"p\" type=\"pat\"/>"
|
|
1294
|
+
"</xsd:choice></xsd:complexType></xsd:element>"
|
|
1295
|
+
"<xsd:simpleType name=\"pat\"><xsd:restriction"
|
|
1296
|
+
" base=\"xsd:string\">"
|
|
1297
|
+
"<xsd:pattern value=\"[a-z]+\"/></xsd:restriction>"
|
|
1298
|
+
"</xsd:simpleType></xsd:schema>";
|
|
1299
|
+
EXPECT_EQ(validate_doc(sch, "<doc><e></e></doc>"), 0);
|
|
1300
|
+
EXPECT_EQ(validate_doc(sch, "<doc><e/></doc>"), 0);
|
|
1301
|
+
EXPECT_EQ(validate_doc(sch, "<doc><p></p></doc>"), 0);
|
|
1302
|
+
EXPECT_EQ(validate_doc(sch, "<doc><e> </e></doc>"), 0);
|
|
1303
|
+
EXPECT_EQ(validate_doc(sch, "<doc><e>5</e></doc>"), 1);
|
|
1304
|
+
EXPECT_EQ(validate_doc(sch, "<doc><p>abc</p></doc>"), 1);
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1307
|
+
// W3C XSD suite msData/regex/p2: a complexType with attributes
|
|
1308
|
+
// only has EMPTY content — character data violates it (XSD 1.0
|
|
1309
|
+
// §3.3.4: whitespace-only text stays legal). The suite instance
|
|
1310
|
+
// <elem>abc</elem> [invalid].
|
|
1311
|
+
TEST(XsdValidate, EmptyContentModelRejectsText) {
|
|
1312
|
+
const char* sch =
|
|
1313
|
+
"<xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">"
|
|
1314
|
+
"<xsd:element name=\"doc\"><xsd:complexType>"
|
|
1315
|
+
"<xsd:sequence><xsd:element name=\"e\" type=\"att-only\"/>"
|
|
1316
|
+
"</xsd:sequence></xsd:complexType></xsd:element>"
|
|
1317
|
+
"<xsd:complexType name=\"att-only\">"
|
|
1318
|
+
"<xsd:attribute name=\"a\" type=\"xsd:integer\"/>"
|
|
1319
|
+
"</xsd:complexType></xsd:schema>";
|
|
1320
|
+
EXPECT_EQ(validate_doc(sch, "<doc><e a=\"9\"/></doc>"), 1);
|
|
1321
|
+
EXPECT_EQ(validate_doc(sch, "<doc><e/></doc>"), 1);
|
|
1322
|
+
/* the oracle rejects even whitespace-only character content
|
|
1323
|
+
* for an empty content type (libxml2-compat, #1691 law) */
|
|
1324
|
+
EXPECT_EQ(validate_doc(sch, "<doc><e> </e></doc>"), 0);
|
|
1325
|
+
EXPECT_EQ(validate_doc(sch, "<doc><e>abc</e></doc>"), 0);
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
// leptris-rs#26 (XSD 1.0 §3.3.3): xsi:nil="true" requires EMPTY
|
|
1329
|
+
// content — the content model is NOT applied to nilled elements
|
|
1330
|
+
// (particlesIa002: e1 nillable minOccurs=2 under an all(a,b)
|
|
1331
|
+
// model, both instances empty+nilled [valid]; QFE1700g2).
|
|
1332
|
+
TEST(XsdValidate, NilledElementSkipsContentModel) {
|
|
1333
|
+
const char* sch =
|
|
1334
|
+
"<xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""
|
|
1335
|
+
" xmlns:x=\"http://xsdtesting\""
|
|
1336
|
+
" targetNamespace=\"http://xsdtesting\""
|
|
1337
|
+
" elementFormDefault=\"qualified\">"
|
|
1338
|
+
"<xsd:complexType name=\"t1\"><xsd:all>"
|
|
1339
|
+
"<xsd:element name=\"a\"/><xsd:element name=\"b\"/>"
|
|
1340
|
+
"</xsd:all></xsd:complexType>"
|
|
1341
|
+
"<xsd:element name=\"doc\"><xsd:complexType>"
|
|
1342
|
+
"<xsd:sequence>"
|
|
1343
|
+
"<xsd:element name=\"e1\" minOccurs=\"2\" maxOccurs=\"2\""
|
|
1344
|
+
" type=\"x:t1\" nillable=\"true\"/>"
|
|
1345
|
+
"</xsd:sequence></xsd:complexType></xsd:element>"
|
|
1346
|
+
"</xsd:schema>";
|
|
1347
|
+
const char* inst =
|
|
1348
|
+
"<?xml version=\"1.0\"?>\n"
|
|
1349
|
+
"<x:doc xmlns:x=\"http://xsdtesting\""
|
|
1350
|
+
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"
|
|
1351
|
+
"<x:e1 xsi:nil=\"true\"/><x:e1 xsi:nil=\"true\"/>"
|
|
1352
|
+
"</x:doc>";
|
|
1353
|
+
EXPECT_EQ(validate_doc(sch, inst), 1);
|
|
1354
|
+
/* nilled with content is a violation */
|
|
1355
|
+
EXPECT_EQ(validate_doc(sch,
|
|
1356
|
+
"<x:doc xmlns:x=\"http://xsdtesting\""
|
|
1357
|
+
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"
|
|
1358
|
+
"<x:e1 xsi:nil=\"true\">x</x:e1>"
|
|
1359
|
+
"<x:e1 xsi:nil=\"true\"/></x:doc>"), 0);
|
|
1360
|
+
/* non-nilled still faces the model */
|
|
1361
|
+
EXPECT_EQ(validate_doc(sch,
|
|
1362
|
+
"<x:doc xmlns:x=\"http://xsdtesting\""
|
|
1363
|
+
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"
|
|
1364
|
+
"<x:e1/><x:e1/></x:doc>"), 0);
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
// leptris-rs#29 (elemZ002): XSD §4.3.6 fixes whiteSpace=collapse
|
|
1368
|
+
// on EVERY builtin except string (preserve) and normalizedString
|
|
1369
|
+
// (replace) — the xsi:type override path must collapse integer
|
|
1370
|
+
// content like the declared path (oracle validates the instance).
|
|
1371
|
+
TEST(XsdValidate, BuiltinCollapseCoversNonStringBuiltins) {
|
|
1372
|
+
const char* sch =
|
|
1373
|
+
"<xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">"
|
|
1374
|
+
"<xsd:element name=\"root\" type=\"xsd:decimal\"/>"
|
|
1375
|
+
"</xsd:schema>";
|
|
1376
|
+
/* the exact elemZ002 shape: override + whitespace-wrapped */
|
|
1377
|
+
EXPECT_EQ(validate_doc(sch,
|
|
1378
|
+
"<?xml version=\"1.0\"?>\n"
|
|
1379
|
+
"<root xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
|
|
1380
|
+
" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""
|
|
1381
|
+
" xsi:type=\"xsd:integer\">\n 123451234\n</root>"), 1);
|
|
1382
|
+
/* the declared path too (no override) */
|
|
1383
|
+
EXPECT_EQ(validate_doc(sch,
|
|
1384
|
+
"<root xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""
|
|
1385
|
+
"> 12345 </root>"), 1);
|
|
1386
|
+
/* collapse does not repair an internal double space into a
|
|
1387
|
+
* valid integer */
|
|
1388
|
+
EXPECT_EQ(validate_doc(sch,
|
|
1389
|
+
"<root xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
|
|
1390
|
+
" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""
|
|
1391
|
+
" xsi:type=\"xsd:integer\">12 345</root>"), 0);
|
|
1392
|
+
/* non-numeric builtins collapse the same way */
|
|
1393
|
+
EXPECT_EQ(validate_doc(sch,
|
|
1394
|
+
"<root xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
|
|
1395
|
+
" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""
|
|
1396
|
+
" xsi:type=\"xsd:boolean\"> true </root>"), 1);
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
// leptris-rs#27 (XSD §4.3.5 + App. E): enumeration membership over
|
|
1400
|
+
// the temporal value spaces compares VALUES, not lexicals —
|
|
1401
|
+
// "2002-01-01T12:01:01+00:00" equals "2002-01-01T12:01:01Z"
|
|
1402
|
+
// (dateTime_enumeration005a/b); time/date normalize the zero
|
|
1403
|
+
// timezone spelling the same way.
|
|
1404
|
+
TEST(XsdDatatypes, TemporalEnumerationComparesByValue) {
|
|
1405
|
+
const char xsd[] =
|
|
1406
|
+
"<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">"
|
|
1407
|
+
"<xs:simpleType name=\"dt\"><xs:restriction base=\"xs:dateTime\">"
|
|
1408
|
+
"<xs:enumeration value=\"2002-01-01T12:01:01Z\"/>"
|
|
1409
|
+
"</xs:restriction></xs:simpleType>"
|
|
1410
|
+
"<xs:simpleType name=\"tm\"><xs:restriction base=\"xs:time\">"
|
|
1411
|
+
"<xs:enumeration value=\"12:01:01Z\"/>"
|
|
1412
|
+
"</xs:restriction></xs:simpleType>"
|
|
1413
|
+
"</xs:schema>";
|
|
1414
|
+
LeptrisStatus st = LEPTRIS_OK;
|
|
1415
|
+
LeptrisXsdSchema s = leptris_xsd_compile(xsd, strlen(xsd), &st);
|
|
1416
|
+
ASSERT_EQ(st, LEPTRIS_OK);
|
|
1417
|
+
ASSERT_NE(s, (LeptrisXsdSchema)0);
|
|
1418
|
+
/* the exact 005a/005b shape: Z in the facet, +00:00 in the doc */
|
|
1419
|
+
EXPECT_EQ(leptris_xsd_simple_valid(
|
|
1420
|
+
s, "dt", "2002-01-01T12:01:01+00:00"), 1);
|
|
1421
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "dt", "2002-01-01T12:01:01Z"),
|
|
1422
|
+
1);
|
|
1423
|
+
/* a shifted-but-equal instant is the same VALUE (App. E):
|
|
1424
|
+
* 07:01:01-05:00 == 12:01:01Z */
|
|
1425
|
+
EXPECT_EQ(leptris_xsd_simple_valid(
|
|
1426
|
+
s, "dt", "2002-01-01T07:01:01-05:00"), 1);
|
|
1427
|
+
/* a different instant stays out */
|
|
1428
|
+
EXPECT_EQ(leptris_xsd_simple_valid(
|
|
1429
|
+
s, "dt", "2002-01-01T12:01:02Z"), 0);
|
|
1430
|
+
/* time: the zero-timezone spellings are the same value; a
|
|
1431
|
+
* different tz is a different value (the tz is part of it) */
|
|
1432
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "tm", "12:01:01+00:00"), 1);
|
|
1433
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "tm", "13:01:01+01:00"), 0);
|
|
1434
|
+
EXPECT_EQ(leptris_xsd_simple_valid(s, "tm", "12:01:02+00:00"), 0);
|
|
1435
|
+
leptris_xsd_free(s);
|
|
1436
|
+
}
|
|
1437
|
+
|
|
937
1438
|
TEST(XsdValidate, ContentModelViolationReports) {
|
|
938
1439
|
EXPECT_EQ(validate_doc(k_v_schema,
|
|
939
1440
|
"<rows version=\"1\">"
|
|
@@ -1542,6 +2043,27 @@ TEST(XsdValidate, FixedElementTextEnforced) {
|
|
|
1542
2043
|
EXPECT_EQ(validate_doc(k_fd_schema, "<ship>sea</ship>"), 0);
|
|
1543
2044
|
}
|
|
1544
2045
|
|
|
2046
|
+
// leptris-rs#25 (v1.9.402 regression; XSD 1.0 §3.12.2/§4.3.1.2):
|
|
2047
|
+
// an element with a fixed value and EMPTY instance content is
|
|
2048
|
+
// VALID — the fixed value supplies the content. Only non-empty
|
|
2049
|
+
// content that differs violates (msData/additional/isDefault001:
|
|
2050
|
+
// <root/> with fixed="abc" [valid]; nine suite rows flipped on
|
|
2051
|
+
// the 1.9.402 ride).
|
|
2052
|
+
TEST(XsdValidate, FixedElementEmptyContentSatisfiedByFixed) {
|
|
2053
|
+
const char* sch =
|
|
2054
|
+
"<xsd:schema xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">"
|
|
2055
|
+
"<xsd:element name=\"root\" type=\"xsd:string\" fixed=\"abc\"/>"
|
|
2056
|
+
"</xsd:schema>";
|
|
2057
|
+
EXPECT_EQ(validate_doc(sch, "<root/>"), 1);
|
|
2058
|
+
EXPECT_EQ(validate_doc(sch, "<root></root>"), 1);
|
|
2059
|
+
EXPECT_EQ(validate_doc(sch, "<root>abc</root>"), 1);
|
|
2060
|
+
EXPECT_EQ(validate_doc(sch, "<root> </root>"), 1);
|
|
2061
|
+
EXPECT_EQ(validate_doc(sch, "<root>xyz</root>"), 0);
|
|
2062
|
+
/* the FIXED-attribute facet keeps its strict reading */
|
|
2063
|
+
EXPECT_EQ(validate_doc(k_fd_schema, "<ship>air</ship>"), 1);
|
|
2064
|
+
EXPECT_EQ(validate_doc(k_fd_schema, "<ship>sea</ship>"), 0);
|
|
2065
|
+
}
|
|
2066
|
+
|
|
1545
2067
|
const char* k_subst_schema =
|
|
1546
2068
|
"<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">"
|
|
1547
2069
|
"<xs:complexType name=\"boxT\">"
|
|
@@ -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.403",
|
|
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,14 +1,14 @@
|
|
|
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.403.1
|
|
5
5
|
platform: arm-linux
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-11-
|
|
11
|
+
date: 2026-11-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: ffi
|