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

Overview
Comment:Code fix.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | schema
Files: files | file ages | folders
SHA3-256: 106ae257a72d9aa75d02d16974ff456b7ec82a8cce10fc1a72e7295200625fa6
User & Date: rolf 2020-02-06 23:41:51
Context
2020-02-10
22:38
Added a few tests. check-in: d1c94a212f user: rolf tags: schema
2020-02-06
23:41
Code fix. check-in: 106ae257a7 user: rolf tags: schema
2020-02-04
01:11
Fasten work. check-in: 121b7f42ad user: rolf tags: schema
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/schema.c.

4890
4891
4892
4893
4894
4895
4896
4897


4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
                }
                h = Tcl_CreateHashEntry (t, pattern->content[i]->name, &hnew);
                if (!hnew) {
                    break;
                }
                Tcl_SetHashValue (h, pattern->content[i]);
            }
            if (!hnew) {


                /* No simple lookup possible because of more than one
                 * elements with the same local name belong to the
                 * choices. Rewind. */
                Tcl_DeleteHashTable (t);
                FREE (t);
            }
            pattern->typedata = (void *)t;
        }
        addToContent (sdata, pattern, quant, n, m);
    } else {
        freeSchemaCP (pattern);
    }
    return result;
}







|
>
>

|




<







4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905

4906
4907
4908
4909
4910
4911
4912
                }
                h = Tcl_CreateHashEntry (t, pattern->content[i]->name, &hnew);
                if (!hnew) {
                    break;
                }
                Tcl_SetHashValue (h, pattern->content[i]);
            }
            if (hnew) {
                pattern->typedata = (void *)t;
            } else {
                /* No simple lookup possible because of more than one
                 * element with the same local name belong to the
                 * choices. Rewind. */
                Tcl_DeleteHashTable (t);
                FREE (t);
            }

        }
        addToContent (sdata, pattern, quant, n, m);
    } else {
        freeSchemaCP (pattern);
    }
    return result;
}

Changes to tests/schema.test.

2630
2631
2632
2633
2634
2635
2636
































2637
2638
2639
2640
2641
2642
2643
        {<doc><e1/><ee3/></doc>}
        {<doc><e1/><ee4/></doc>}
        {<doc><e1/><e2/><ee4/></doc>}
        {<doc><e1/><ee2/><e2/></doc>}
    } {
        lappend result [grammar validate $xml]
    }
































    grammar delete
    set result
} {0 1 1 1 1 0 1}

test schema-10.1 {any} {
    tdom::schema create s
    s define {







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
        {<doc><e1/><ee3/></doc>}
        {<doc><e1/><ee4/></doc>}
        {<doc><e1/><e2/><ee4/></doc>}
        {<doc><e1/><ee2/><e2/></doc>}
    } {
        lappend result [grammar validate $xml]
    }
    grammar delete
    set result
} {0 1 1 1 1 0 1}

test schema-9.11 {choice with may choices} {
    tdom::schema create grammar
    grammar define {
        defelement doc {
            element e1
            choice * {
                for {set i 1} {$i <= 20} {incr i} {
                    namespace foo {
                        element ee$i
                    }
                    element ee$i
                }
            }
            element e2 ?
        }
    }
    set result [list]
    foreach xml {
        {<doc xmlns:foo="foo"/>}
        {<doc xmlns:foo="foo"><e1/></doc>}
        {<doc xmlns:foo="foo"><e1/><e2/></doc>}
        {<doc xmlns:foo="foo"><e1/><ee3/></doc>}
        {<doc xmlns:foo="foo"><e1/><foo:ee4/></doc>}
        {<doc xmlns:foo="foo"><e1/><e2/><ee4/></doc>}
        {<doc xmlns:foo="foo"><e1/><foo:ee2/><e2/></doc>}
    } {
        lappend result [grammar validate $xml]
    }
    grammar delete
    set result
} {0 1 1 1 1 0 1}

test schema-10.1 {any} {
    tdom::schema create s
    s define {