tDOM

Check-in [39651ce911]
Login

Check-in [39651ce911]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:If recovering from the error "text doesn't match constraint" pretent the text has matched so the not matched required text cp isn't reported again as missing text.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | keyspaces
Files: files | file ages | folders
SHA3-256: 39651ce91113ad9ab4e50e3a329eed7e17b434b87ea55e5046050c449733ab6c
User & Date: rolf 2019-05-30 01:02:22.256
Context
2019-05-30
22:38
Added simple keyref feature to keyspaces. check-in: 1f7b8a81c1 user: rolf tags: keyspaces
01:02
If recovering from the error "text doesn't match constraint" pretent the text has matched so the not matched required text cp isn't reported again as missing text. check-in: 39651ce911 user: rolf tags: keyspaces
2019-05-29
12:57
Starts to actually do something. Still some way to go. check-in: 6eb6891a1e user: rolf tags: keyspaces
Changes
Side-by-Side Diff Ignore Whitespace Patch
Changes to generic/schema.c.
1799
1800
1801
1802
1803
1804
1805

1806
1807
1808
1809
1810
1811
1812
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813







+







                    if (checkText (interp, candidate, text)) {
                        updateStack (se, cp, ac);
                        return 1;
                    }
                    if (!sdata->evalError) {
                        SetResult ("Invalid text content");
                    }
                    updateStack (se, cp, ac);
                    return 0;

                case SCHEMA_CTYPE_CHOICE:
                    if (candidate->flags & MIXED_CONTENT) {
                        updateStack (se, cp, ac);
                        return 1;
                    }
Changes to tests/schema.test.
4576
4577
4578
4579
4580
4581
4582
















































4583
4584
4585
4586
4587
4588
4589
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







        set rc [s validate $xml]
        lappend result $rc
    }
    s delete
    set result
} {s UNKNOWN_ROOT_ELEMENT 1 s UNKNOWN_ROOT_ELEMENT 1 s UNKNOWN_ROOT_ELEMENT 1 s UNKNOWN_ROOT_ELEMENT 1}

test schema-18.4 {reportcmd} {
    tdom::schema s
    s define {
        defelement doc {
            element items * {
                element item * {
                    attribute ref {integer}
                }
            }
        }
    }
    s reportcmd schema-18
    set result [list]
    foreach xml {
        {<doc><items><item ref="1"/><item ref="1"/></items><items><item ref="1"/><item ref="1"/></items></doc>}
        {<doc><items><item ref="1"/><item ref="a"/></items><items><item ref="b"/><item ref="1"/></items></doc>}
    } {
        lappend result [s validate $xml]
    }
    s delete
    set result
} {1 s WRONG_ATTRIBUTE_VALUE s WRONG_ATTRIBUTE_VALUE 1}

test schema-18.5 {reportcmd} {
    tdom::schema s
    s define {
        defelement doc {
            element items * {
                element item * {
                    text {minLength 2}
                }
            }
        }
    }
    s reportcmd schema-18
    set result [list]
    foreach xml {
        {<doc><items><item>1</item></items></doc>}
        {<doc><items><item>1</item><item/></items></doc>}
        {<doc><items><item>>12</item><item>ab</item></items></doc>}

    } {
        lappend result [s validate $xml]
    }
    s delete
    set result
} {s WRONG_VALUE 1 s WRONG_VALUE s MISSING_TEXT 1 1}

proc validatedSAX {g xml {keepEmpties 1}} {
    set args [list -validateCmd $g]
    if {!$keepEmpties} {
        lappend args -ignorewhitespace 1
    }
    xml::parser p {*}$args
    set rc [catch {p parse $xml} errMsg]
4638
4639
4640
4641
4642
4643
4644



























4645
4646
4647
4648
4649
4650
4651
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







    } {
        lappend result [s validate $xml]
    }
    s delete
    set result
} {1 0 1 1 1 0}

test schema-19.2 {keyspace} {
    tdom::schema s
    s define {
        defelement doc {
            element items * {
                keyspace ref {
                    element item * {
                        attribute ref ? {
                            key ref
                        }
                    }
                }
            }
        }
    }
    s reportcmd schema-18
    set result [list]
    foreach xml {
        {<doc><items><item ref="1"/><item ref="1"/></items><items><item ref="1"/><item ref="1"/></items></doc>}
        {<doc><items><item ref="1"/><item ref="a"/></items><items><item ref="c"/><item ref="d"/></items></doc>}
    } {
        lappend result [s validate $xml]
    }
    s delete
    set result
} {s WRONG_ATTRIBUTE_VALUE s WRONG_ATTRIBUTE_VALUE 1 1}
        
test schema-20.1 {domunique} {
    set schema {
        prefixns {ns1 http://tdom.org/test}
        defelement doc {
            domunique ${::schema-20.1} @ref
        }
    }