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

Overview
Comment:Added flag -ignorematched to the schema command submethod info expected.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | schema
Files: files | file ages | folders
SHA3-256: 0dc7c2f6ccf1a6dbe8bf666ba40e0866666521fef9dd6bcbf460c19ac0a6447f
User & Date: rolf 2020-03-14 03:25:36
Original Comment: Added flag -ignorematched to the schema commant submethod info expected.
Context
2020-03-17
23:55
Micro optimization. check-in: fd743f35c1 user: rolf tags: schema
2020-03-14
12:05
Merged from schema. check-in: ee3147fc64 user: rolf tags: wip
03:25
Added flag -ignorematched to the schema command submethod info expected. check-in: 0dc7c2f6cc user: rolf tags: schema
03:24
Fixed the damn thing. Closed-Leaf check-in: 8fb5a0b988 user: rolf tags: wip2
02:48
Gardening. check-in: 74cd3204f1 user: rolf tags: schema
Changes

Changes to generic/schema.c.

3506
3507
3508
3509
3510
3511
3512
3513

3514
3515
3516
3517
3518
3519
3520




3521

3522
3523
3524
3525
3526
3527
3528
....
3542
3543
3544
3545
3546
3547
3548
3549

3550
3551
3552
3553
3554
3555
3556
....
3579
3580
3581
3582
3583
3584
3585
3586

3587
3588
3589
3590
3591
3592
3593
....
3687
3688
3689
3690
3691
3692
3693
3694

3695
3696
3697
3698
3699
3700
3701
....
3704
3705
3706
3707
3708
3709
3710
3711

3712
3713
3714
3715
3716
3717
3718
....
3719
3720
3721
3722
3723
3724
3725
3726

3727
3728
3729
3730
3731
3732
3733
....
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
....
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893









3894
3895
3896
3897
3898
3899
3900
....
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915

static int
getNextExpectedWorker (
    SchemaData *sdata,
    SchemaValidationStack *se,
    Tcl_Interp *interp,
    Tcl_HashTable *seenCPs,
    Tcl_Obj *rObj

    )
{
    int ac, hm, i, hnew, mustMatch, mayskip, rc = 1;
    SchemaCP *cp, *ic, *jc;
    SchemaValidationStack *se1;

    getContext (cp, ac, hm);




    if (hm && maxOne(cp->quants[ac])) ac++;

    switch (cp->type) {
    case SCHEMA_CTYPE_INTERLEAVE:
        ac = 0;
        mustMatch = 0;
        /* Fall through */
    case SCHEMA_CTYPE_NAME:
    case SCHEMA_CTYPE_PATTERN:
................................................................................
                break;
            case SCHEMA_CTYPE_INTERLEAVE:
            case SCHEMA_CTYPE_PATTERN:
                Tcl_CreateHashEntry (seenCPs, ic, &hnew);
                if (hnew) {
                    se1 = getStackElement (sdata, ic);
                    mayskip = getNextExpectedWorker (sdata, se1, interp,
                                                     seenCPs, rObj);

                    repoolStackElement (sdata, se1);
                }
                break;

            case SCHEMA_CTYPE_ANY:
                Tcl_ListObjAppendElement (interp, rObj,
                                          serializeAnyCP (interp, ic));
................................................................................
                        break;
                    case SCHEMA_CTYPE_INTERLEAVE:
                    case SCHEMA_CTYPE_PATTERN:
                        Tcl_CreateHashEntry (seenCPs, jc, &hnew);
                        if (hnew) {
                            se1 = getStackElement (sdata, ic);
                            mayskip = getNextExpectedWorker (
                                sdata, se1, interp, seenCPs, rObj

                                );
                            repoolStackElement (sdata, se1);
                        }
                        break;
                    case SCHEMA_CTYPE_ANY:
                        Tcl_ListObjAppendElement (
                            interp, rObj, serializeAnyCP (interp, jc)
................................................................................
    Tcl_DeleteHashTable (htable);
    return rObj;
}

static void
getNextExpected (
    SchemaData *sdata,
    Tcl_Interp *interp

    )
{
    int remainingLastMatch, count, rc;
    Tcl_Obj *rObj;
    Tcl_HashTable localHash;
    SchemaValidationStack *se;

................................................................................
    remainingLastMatch = 0;
    if (sdata->lastMatchse) {
        se = sdata->lastMatchse;
        while (se->down) {
            remainingLastMatch++;
            se = se->down;
        }
        while (se && getNextExpectedWorker (sdata, se, interp, &localHash, rObj)) {

            if (remainingLastMatch) {
                count = 1;
                se = sdata->lastMatchse;
                while (count < remainingLastMatch) {
                    se = se->down;
                    count++;
                }
................................................................................
                remainingLastMatch--;
            } else break;
        }
    }
    
    se = sdata->stack;
    while (se) {
        rc = getNextExpectedWorker (sdata, se, interp, &localHash, rObj);

        if (se->pattern->type == SCHEMA_CTYPE_NAME) break;
        se = se->down;
        if (!rc) {
            if (mayMiss(se->pattern->quants[se->activeChild])) continue;
            break;
        }
    }
................................................................................
schemaInstanceInfoCmd (
    SchemaData *sdata,
    Tcl_Interp *interp,
    int objc,
    Tcl_Obj *const objv[]
    )
{
    int methodIndex;
    long line, column;
    Tcl_HashEntry *h;
    SchemaCP *cp;
    SchemaValidationStack *se;
    void *ns;
    Tcl_Obj *rObj;
    
................................................................................
            SetBooleanResult (0);
        } else {
            SetBooleanResult (1);
        }
        return TCL_OK;

    case m_expected:
        if (objc != 2) {
            Tcl_WrongNumArgs (interp, 2, objv, "");
            return TCL_ERROR;
        }









        if (sdata->validationState == VALIDATION_ERROR
            || sdata->validationState == VALIDATION_FINISHED) {
            return TCL_OK;
        }
        if (!sdata->stack) {
            if (sdata->start) {
                Tcl_AppendElement (interp, sdata->start);
................................................................................
                if (sdata->startNamespace) {
                    Tcl_AppendElement (interp, sdata->startNamespace);
                }
            } else {
                definedElements (sdata, interp);
            }
        } else {
            getNextExpected (sdata, interp);
        }
        break;
        
    case m_definition:
        if (objc < 3 && objc > 4) {
            Tcl_WrongNumArgs (interp, 1, objv, "name ?namespace?");
            return TCL_ERROR;







|
>







>
>
>
>
|
>







 







|
>







 







|
>







 







|
>







 







|
>







 







|
>







 







|







 







|
|


>
>
>
>
>
>
>
>
>







 







|







3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
....
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
....
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
....
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
....
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
....
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
....
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
....
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
....
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935

static int
getNextExpectedWorker (
    SchemaData *sdata,
    SchemaValidationStack *se,
    Tcl_Interp *interp,
    Tcl_HashTable *seenCPs,
    Tcl_Obj *rObj,
    int ignoreMatched
    )
{
    int ac, hm, i, hnew, mustMatch, mayskip, rc = 1;
    SchemaCP *cp, *ic, *jc;
    SchemaValidationStack *se1;

    getContext (cp, ac, hm);
    if (ignoreMatched && hm) {
        ac++;
        hm = 0;
    } else {
        if (hm && maxOne(cp->quants[ac])) ac++;
    }
    switch (cp->type) {
    case SCHEMA_CTYPE_INTERLEAVE:
        ac = 0;
        mustMatch = 0;
        /* Fall through */
    case SCHEMA_CTYPE_NAME:
    case SCHEMA_CTYPE_PATTERN:
................................................................................
                break;
            case SCHEMA_CTYPE_INTERLEAVE:
            case SCHEMA_CTYPE_PATTERN:
                Tcl_CreateHashEntry (seenCPs, ic, &hnew);
                if (hnew) {
                    se1 = getStackElement (sdata, ic);
                    mayskip = getNextExpectedWorker (sdata, se1, interp,
                                                     seenCPs, rObj,
                                                     ignoreMatched);
                    repoolStackElement (sdata, se1);
                }
                break;

            case SCHEMA_CTYPE_ANY:
                Tcl_ListObjAppendElement (interp, rObj,
                                          serializeAnyCP (interp, ic));
................................................................................
                        break;
                    case SCHEMA_CTYPE_INTERLEAVE:
                    case SCHEMA_CTYPE_PATTERN:
                        Tcl_CreateHashEntry (seenCPs, jc, &hnew);
                        if (hnew) {
                            se1 = getStackElement (sdata, ic);
                            mayskip = getNextExpectedWorker (
                                sdata, se1, interp, seenCPs, rObj,
                                ignoreMatched
                                );
                            repoolStackElement (sdata, se1);
                        }
                        break;
                    case SCHEMA_CTYPE_ANY:
                        Tcl_ListObjAppendElement (
                            interp, rObj, serializeAnyCP (interp, jc)
................................................................................
    Tcl_DeleteHashTable (htable);
    return rObj;
}

static void
getNextExpected (
    SchemaData *sdata,
    Tcl_Interp *interp,
    int         ignoreMatched
    )
{
    int remainingLastMatch, count, rc;
    Tcl_Obj *rObj;
    Tcl_HashTable localHash;
    SchemaValidationStack *se;

................................................................................
    remainingLastMatch = 0;
    if (sdata->lastMatchse) {
        se = sdata->lastMatchse;
        while (se->down) {
            remainingLastMatch++;
            se = se->down;
        }
        while (se && getNextExpectedWorker (sdata, se, interp, &localHash, rObj,
                   ignoreMatched)) {
            if (remainingLastMatch) {
                count = 1;
                se = sdata->lastMatchse;
                while (count < remainingLastMatch) {
                    se = se->down;
                    count++;
                }
................................................................................
                remainingLastMatch--;
            } else break;
        }
    }
    
    se = sdata->stack;
    while (se) {
        rc = getNextExpectedWorker (sdata, se, interp, &localHash, rObj,
                                    ignoreMatched);
        if (se->pattern->type == SCHEMA_CTYPE_NAME) break;
        se = se->down;
        if (!rc) {
            if (mayMiss(se->pattern->quants[se->activeChild])) continue;
            break;
        }
    }
................................................................................
schemaInstanceInfoCmd (
    SchemaData *sdata,
    Tcl_Interp *interp,
    int objc,
    Tcl_Obj *const objv[]
    )
{
    int methodIndex, ignoreMatched;
    long line, column;
    Tcl_HashEntry *h;
    SchemaCP *cp;
    SchemaValidationStack *se;
    void *ns;
    Tcl_Obj *rObj;
    
................................................................................
            SetBooleanResult (0);
        } else {
            SetBooleanResult (1);
        }
        return TCL_OK;

    case m_expected:
        if (objc != 2 && objc != 3) {
            Tcl_WrongNumArgs (interp, 2, objv, "?-ignorematched?");
            return TCL_ERROR;
        }
        ignoreMatched = 0;
        if (objc == 3) {
            if (strcmp (Tcl_GetString (objv[2]), "-ignorematched") != 0) {
                SetResult ("Expected -ignorematched");
                return TCL_ERROR;
            }
            ignoreMatched = 1;
        }
        
        if (sdata->validationState == VALIDATION_ERROR
            || sdata->validationState == VALIDATION_FINISHED) {
            return TCL_OK;
        }
        if (!sdata->stack) {
            if (sdata->start) {
                Tcl_AppendElement (interp, sdata->start);
................................................................................
                if (sdata->startNamespace) {
                    Tcl_AppendElement (interp, sdata->startNamespace);
                }
            } else {
                definedElements (sdata, interp);
            }
        } else {
            getNextExpected (sdata, interp, ignoreMatched);
        }
        break;
        
    case m_definition:
        if (objc < 3 && objc > 4) {
            Tcl_WrongNumArgs (interp, 1, objv, "name ?namespace?");
            return TCL_ERROR;

Changes to tests/schema.test.

6339
6340
6341
6342
6343
6344
6345




















6346
6347
6348
6349
6350
6351
6352
....
6363
6364
6365
6366
6367
6368
6369























6370
6371
6372
6373
6374
6375
6376
....
6383
6384
6385
6386
6387
6388
6389























6390
6391
6392
6393
6394
6395
6396
....
6411
6412
6413
6414
6415
6416
6417




























6418
6419
6420
6421
6422
6423
6424
....
6479
6480
6481
6482
6483
6484
6485






































6486
6487
6488
6489
6490
6491
6492
....
6503
6504
6505
6506
6507
6508
6509
























6510
6511
6512
6513
6514
6515
6516
....
6523
6524
6525
6526
6527
6528
6529






















6530
6531
6532
6533
6534
6535
6536
....
6572
6573
6574
6575
6576
6577
6578














































6579
6580
6581
6582
6583
6584




























6585
6586
6587
6588
6589
6590
6591
....
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
....
6697
6698
6699
6700
6701
6702
6703






































6704






































6705
6706
6707
6708
6709
6710
6711
....
6905
6906
6907
6908
6909
6910
6911
































6912
6913
6914
6915
6916
6917
6918
        }
    }
    s event start doc
    set result [s info expected]
    s delete
    lsort $result
} {a b c musthave toplevel}





















test schema-17.6 {info expected} {
    tdom::schema s
    s prefixns {foo http://foo.bar}
    s define {
        defelement doc {
            choice ? {
................................................................................
    }
    s event start doc
    set result [s info expected]
    s delete
    lsort $result
} {a b c {musthave http://foo.bar} toplevel}
























test schema-17.7 {info expected} {
    tdom::schema s
    s prefixns {foo http://foo.bar}
    s define {
        defelement doc {
            mixed {
                element a
................................................................................
            }
            element aftermust
        }
    }
    s event start doc
    set result [s info expected]
    s delete























    lsort $result
} {a b c {musthave http://foo.bar} toplevel {{#text} {}}}

test schema-17.8 {info expected} {
    tdom::schema s
    s defelement doc {
        choice ? {
................................................................................
    lappend result {*}[lsort [s info expected]]
    s event start doc
    lappend result {*}[lsort [s info expected]]
    s event start c
    s event end
    lappend result {*}[lsort [s info expected]]
    s delete




























    set result
} {doc a b c doc a b c musthave toplevel musthave toplevel}

proc schema-17.9 {scmd} {
    global result
    lappend result {*}[lsort [$scmd info expected]]
}
................................................................................
        s defelement doc $def
        s event start doc
        lappend result {*}[lsort [s info expected]]
        s delete
    }
    set result
} {a b c a b c d a b c d}







































test schema-17.11 {info expected} {
    set defs {
        {
            group + {
                element c ?
                element a ?
................................................................................
        s event start b
        s event end
        set result [lsort [s info expected]]
        s delete
    }
    set result
} {a b c d}

























test schema-17.12 {info expected} {
    tdom::schema s
    s define {
        prefixns {ns1 http://foo.bar}
        defelement doc {
            element a
................................................................................
    s event start a
    s event end
    set result [lsort [s info expected]]
    s event start something
    s event end
    lappend result {*}[lsort [s info expected]]
    s delete






















    set result
} {{<any> {}} {<any> http://foo.bar} {<elementend> {}} b}

proc schema-17.13 {scmd args} {
    global fromReportCmd
    set fromReportCmd [lsort [$scmd info expected]]
}
................................................................................
        }
        s delete
        incr defnr
    }
    set result
} {0/0: 1 a 0/1: 1 0/2: 1 a 0/3: 1 0/4: 1 a 0/5: 1 {<elementend> {}} b 1/0: 1 a b 1/1: 1 b 1/2: 1 1/3: 1 1/4: 1 a b 1/5: 1 b 2/0: 1 2/1: 1 2/2: 1 2/3: 1 2/4: 1 {<elementend> {}} a b 2/5: 1 {<elementend> {}} b}















































proc schema-17.14 {scmd args} {
    global result
    lappend result {*}[lsort [$scmd info expected]]
}
test schema-17.14 {info expected} {
    set defs {




























        {
            group + {
                element c ?
                element a ?
                element b ?
            }
            tcl schema-17.14 [self]
................................................................................
        lappend result [s validate $xml]
        lappend result {*}$fromReportCmd
    }
    s delete
    set result
} {0 0 1 1 aaaa 1 b bb bbb bbbb 1}

test schema-17.16a {info expected} {
    tdom::schema s
    s defelement doc {
        element a
        group {
            group {
                group {
                    element aaaa *
                    element bbbb ?
                }
                element bbb ?
            }
            element bb ?
        }
        element b
................................................................................
    } {
        set fromReportCmd ""
        lappend result [s validate $xml]
        lappend result {*}$fromReportCmd
    }
    s delete
    set result






































} {0 0 1 1 aaaa b bb bbb bbbb 1 aaaa b bb bbb bbbb 1}







































test schema-17.16b {info expected} {
    tdom::schema s
    s defelement doc {
        element a
        group {
            group {
................................................................................
        <doc><a/><b/></doc>
    } {
        lappend result [s validate $xml]
    }
    s delete
    set result
} {{} 1 1 1 {fo bar baz} 1 {} 1}

































proc schema-18 {args} {
    lappend ::result {*}$args
}
test schema-18.1 {reportcmd} {
    tdom::schema s
    s define {







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







 







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







 







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







 







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







 







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







 







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







 







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







 







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






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







 







|






|







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







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







6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
....
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
....
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
....
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
....
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
....
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
....
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
....
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
....
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
....
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
....
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
        }
    }
    s event start doc
    set result [s info expected]
    s delete
    lsort $result
} {a b c musthave toplevel}

test schema-17.5a {info expected} {
    tdom::schema s
    s define {
        defelement doc {
            choice ? {
                element a
                element c
                element b
            }
            element toplevel ?
            element musthave
            element aftermust
        }
    }
    s event start doc
    set result [s info expected -ignorematched]
    s delete
    lsort $result
} {a b c musthave toplevel}

test schema-17.6 {info expected} {
    tdom::schema s
    s prefixns {foo http://foo.bar}
    s define {
        defelement doc {
            choice ? {
................................................................................
    }
    s event start doc
    set result [s info expected]
    s delete
    lsort $result
} {a b c {musthave http://foo.bar} toplevel}

test schema-17.6a {info expected} {
    tdom::schema s
    s prefixns {foo http://foo.bar}
    s define {
        defelement doc {
            choice ? {
                element a
                element c
                element b
            }
            element toplevel ?
            namespace foo {
                element musthave
            }
            element aftermust
        }
    }
    s event start doc
    set result [s info expected -ignorematched]
    s delete
    lsort $result
} {a b c {musthave http://foo.bar} toplevel}

test schema-17.7 {info expected} {
    tdom::schema s
    s prefixns {foo http://foo.bar}
    s define {
        defelement doc {
            mixed {
                element a
................................................................................
            }
            element aftermust
        }
    }
    s event start doc
    set result [s info expected]
    s delete
    lsort $result
} {a b c {musthave http://foo.bar} toplevel {{#text} {}}}

test schema-17.7a {info expected} {
    tdom::schema s
    s prefixns {foo http://foo.bar}
    s define {
        defelement doc {
            mixed {
                element a
                element c
                element b
            }
            element toplevel ?
            namespace foo {
                element musthave
            }
            element aftermust
        }
    }
    s event start doc
    set result [s info expected -ignorematched]
    s delete
    lsort $result
} {a b c {musthave http://foo.bar} toplevel {{#text} {}}}

test schema-17.8 {info expected} {
    tdom::schema s
    s defelement doc {
        choice ? {
................................................................................
    lappend result {*}[lsort [s info expected]]
    s event start doc
    lappend result {*}[lsort [s info expected]]
    s event start c
    s event end
    lappend result {*}[lsort [s info expected]]
    s delete
    set result
} {doc a b c doc a b c musthave toplevel musthave toplevel}

test schema-17.8a {info expected} {
    tdom::schema s
    s defelement doc {
        choice ? {
            element a
            element c
            element b
        }
        element toplevel ?
        element musthave
        element aftermust
    }
    set result [s info expected -ignorematched]
    s define {
        foreach elm {a b c} {
            defelement $elm {}
        }
    }
    lappend result {*}[lsort [s info expected -ignorematched]]
    s event start doc
    lappend result {*}[lsort [s info expected -ignorematched]]
    s event start c
    s event end
    lappend result {*}[lsort [s info expected -ignorematched]]
    s delete
    set result
} {doc a b c doc a b c musthave toplevel musthave toplevel}

proc schema-17.9 {scmd} {
    global result
    lappend result {*}[lsort [$scmd info expected]]
}
................................................................................
        s defelement doc $def
        s event start doc
        lappend result {*}[lsort [s info expected]]
        s delete
    }
    set result
} {a b c a b c d a b c d}

test schema-17.10a {info expected interleave} {
    set defs {
        {
            interleave {
                element a ?
                element b
                element c ?
            }
            element d
        }
        {
            interleave {
                element a ?
                element b ?
                element c ?
            }
            element d
        }
        {
            interleave ? {
                element a ?
                element b
                element c ?
            }
            element d
        }
    }
    set result [list]
    foreach def $defs {
        tdom::schema s
        s defelement doc $def
        s event start doc
        lappend result {*}[lsort [s info expected -ignorematched]]
        s delete
    }
    set result
} {a b c a b c d a b c d}

test schema-17.11 {info expected} {
    set defs {
        {
            group + {
                element c ?
                element a ?
................................................................................
        s event start b
        s event end
        set result [lsort [s info expected]]
        s delete
    }
    set result
} {a b c d}

test schema-17.11a {info expected} {
    set defs {
        {
            group + {
                element c ?
                element a ?
                element b ?
            }
            element d
        }
    }
    set result [list]
    foreach def $defs {
        tdom::schema s
        s defelement doc $def
        s event start doc
        s event start b
        s event end
        set result [lsort [s info expected -ignorematched]]
        s delete
    }
    set result
} {d}

test schema-17.12 {info expected} {
    tdom::schema s
    s define {
        prefixns {ns1 http://foo.bar}
        defelement doc {
            element a
................................................................................
    s event start a
    s event end
    set result [lsort [s info expected]]
    s event start something
    s event end
    lappend result {*}[lsort [s info expected]]
    s delete
    set result
} {{<any> {}} {<any> http://foo.bar} {<elementend> {}} b}

test schema-17.12a {info expected} {
    tdom::schema s
    s define {
        prefixns {ns1 http://foo.bar}
        defelement doc {
            element a
            any
            any ns1 ?
            element b ?
        }
    }
    s event start doc
    s event start a
    s event end
    set result [lsort [s info expected -ignorematched]]
    s event start something
    s event end
    lappend result {*}[lsort [s info expected -ignorematched]]
    s delete
    set result
} {{<any> {}} {<any> http://foo.bar} {<elementend> {}} b}

proc schema-17.13 {scmd args} {
    global fromReportCmd
    set fromReportCmd [lsort [$scmd info expected]]
}
................................................................................
        }
        s delete
        incr defnr
    }
    set result
} {0/0: 1 a 0/1: 1 0/2: 1 a 0/3: 1 0/4: 1 a 0/5: 1 {<elementend> {}} b 1/0: 1 a b 1/1: 1 b 1/2: 1 1/3: 1 1/4: 1 a b 1/5: 1 b 2/0: 1 2/1: 1 2/2: 1 2/3: 1 2/4: 1 {<elementend> {}} a b 2/5: 1 {<elementend> {}} b}

proc schema-17.13a {scmd args} {
    global fromReportCmd
    set fromReportCmd [lsort [$scmd info expected -ignorematched]]
}
test schema-17.13a {info expected} {
    set defs {
        {
            element a
            element b ?
        }
        {
            element a ?
            element b
        }
        {
            element a ?
            element b ?
        }
    }
    set xmlinput {
        <doc/>
        <doc><a/></doc>
        <doc><b/></doc>
        <doc><a/><b/></doc>
        <doc><unknown/></doc>
        <doc><a/><unknown/></doc>
    }
    set result [list]
    set defnr 0
    foreach def $defs {
        tdom::schema s
        s defelement doc $def
        s reportcmd schema-17.13
        set xmlnr 0
        foreach xml $xmlinput {
            set fromReportCmd ""
            lappend result $defnr/$xmlnr: [s validate $xml errMsg]
            lappend result {*}$fromReportCmd
            incr xmlnr
        }
        s delete
        incr defnr
    }
    set result
} {0/0: 1 a 0/1: 1 0/2: 1 a 0/3: 1 0/4: 1 a 0/5: 1 {<elementend> {}} b 1/0: 1 a b 1/1: 1 b 1/2: 1 1/3: 1 1/4: 1 a b 1/5: 1 b 2/0: 1 2/1: 1 2/2: 1 2/3: 1 2/4: 1 {<elementend> {}} a b 2/5: 1 {<elementend> {}} b}

proc schema-17.14 {scmd args} {
    global result
    lappend result {*}[lsort [$scmd info expected]]
}
test schema-17.14 {info expected} {
    set defs {
        {
            group + {
                element c ?
                element a ?
                element b ?
            }
            tcl schema-17.14 [self]
            element d
        }
    }
    set result [list]
    foreach def $defs {
        tdom::schema s
        s reportcmd schema-17.14
        s defelement doc $def
        s event start doc
        s event start unknownElement
        s delete
    }
    set result
} {a b c d a b c d}

proc schema-17.14a {scmd args} {
    global result
    lappend result {*}[lsort [$scmd info expected -ignorematched]]
}
test schema-17.14a {info expected} {
    set defs {
        {
            group + {
                element c ?
                element a ?
                element b ?
            }
            tcl schema-17.14 [self]
................................................................................
        lappend result [s validate $xml]
        lappend result {*}$fromReportCmd
    }
    s delete
    set result
} {0 0 1 1 aaaa 1 b bb bbb bbbb 1}

test schema-17.16_1{info expected} {
    tdom::schema s
    s defelement doc {
        element a
        group {
            group {
                group {
                    element aaaa
                    element bbbb ?
                }
                element bbb ?
            }
            element bb ?
        }
        element b
................................................................................
    } {
        set fromReportCmd ""
        lappend result [s validate $xml]
        lappend result {*}$fromReportCmd
    }
    s delete
    set result
} {0 0 1 1 aaaa 1 b bb bbb bbbb 1}

test schema-17.16a {info expected} {
    tdom::schema s
    s defelement doc {
        element a
        group {
            group {
                group {
                    element aaaa *
                    element bbbb ?
                }
                element bbb ?
            }
            element bb ?
        }
        element b
    }
    set result [list]
    foreach xml {
        <doc><a/></doc>
        <doc><a/><aaaa/></doc>
        <doc><a/><aaaa/><b/></doc>
    } {
        lappend result [s validate $xml]
    }
    s reportcmd schema-17.13a
    foreach xml {
        <doc><a/></doc>
        <doc><a/><aaaa/></doc>
        <doc><a/><aaaa/><b/></doc>
    } {
        set fromReportCmd ""
        lappend result [s validate $xml]
        lappend result {*}$fromReportCmd
    }
    s delete
    set result
} {0 0 1 1 aaaa b bb bbb bbbb 1 b bb bbb bbbb 1}

test schema-17.16a_1 {info expected} {
    tdom::schema s
    s defelement doc {
        element a
        group {
            group {
                group {
                    element aaaa *
                    element bbbb ?
                }
                element bbb ?
            }
            element bb ?
        }
        element b
    }
    set result [list]
    foreach xml {
        <doc><a/></doc>
        <doc><a/><aaaa/></doc>
        <doc><a/><aaaa/><b/></doc>
    } {
        lappend result [s validate $xml]
    }
    s reportcmd schema-17.13a
    foreach xml {
        <doc><a/></doc>
        <doc><a/><aaaa/></doc>
        <doc><a/><aaaa/><b/></doc>
    } {
        set fromReportCmd ""
        lappend result [s validate $xml]
        lappend result {*}$fromReportCmd
    }
    s delete
    set result
} {0 0 1 1 aaaa b bb bbb bbbb 1 b bb bbb bbbb 1}

test schema-17.16b {info expected} {
    tdom::schema s
    s defelement doc {
        element a
        group {
            group {
................................................................................
        <doc><a/><b/></doc>
    } {
        lappend result [s validate $xml]
    }
    s delete
    set result
} {{} 1 1 1 {fo bar baz} 1 {} 1}

proc schema-17.21 {scmd errorInfo} {
    lappend ::result [$scmd info expected]
}
test schema-17.21 {info expected} {
    tdom::schema s
    s defelement doc {
        element a + {}
        element b ! {}
    }
    s reportcmd schema-17.21
    set result ""
    lappend result [s validate {<doc><a/><unexpected/></doc>}]
    s delete
    set result
} {{a b} 1}

proc schema-17.21a {scmd errorInfo} {
    lappend ::result [$scmd info expected -ignorematched]
}
test schema-17.21a {info expected} {
    tdom::schema s
    s defelement doc {
        element a + {}
        element b ! {}
    }
    s reportcmd schema-17.21a
    set result ""
    lappend result [s validate {<doc><a/><unexpected/></doc>}]
    s delete
    set result
} {b 1}

proc schema-18 {args} {
    lappend ::result {*}$args
}
test schema-18.1 {reportcmd} {
    tdom::schema s
    s define {