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

Overview
Comment:Ensure that the script error of a script evaluated by a schema command pops up to global level.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | schema
Files: files | file ages | folders
SHA3-256: a15e6f3d24b97511297d99434a1efb6ae13fb6f29edcc5d2985b3d8df9bd01e1
User & Date: rolf 2019-10-19 00:08:44
Context
2019-10-19
01:46
Removed old cruft, simplified (a bit) the central data structure; we have a finit, known in advance set of of quents. check-in: 39d74a1df4 user: rolf tags: schema
00:08
Ensure that the script error of a script evaluated by a schema command pops up to global level. check-in: a15e6f3d24 user: rolf tags: schema
2019-10-18
23:43
Don't call event on a schem command in any script evaluated from the same schema command. check-in: d1707acfbf user: rolf tags: schema
Changes

Changes to generic/schema.c.

1904
1905
1906
1907
1908
1909
1910

1911

1912
1913
1914
1915
1916
1917
1918
        }
        DBG(
            fprintf(stderr, "probeElementEnd: _CAN_ end here.\n");
            serializeStack (sdata);
            );
        return TCL_OK;
    }

    SetResult ("Missing mandatory content");

    sdata->validationState = VALIDATION_ERROR;
    DBG(
        fprintf(stderr, "probeElementEnd: CAN'T end here.\n");
        serializeStack (sdata);
        );
    return TCL_ERROR;
}







>
|
>







1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
        }
        DBG(
            fprintf(stderr, "probeElementEnd: _CAN_ end here.\n");
            serializeStack (sdata);
            );
        return TCL_OK;
    }
    if (!sdata->evalError) {
        SetResult ("Missing mandatory content");
    }
    sdata->validationState = VALIDATION_ERROR;
    DBG(
        fprintf(stderr, "probeElementEnd: CAN'T end here.\n");
        serializeStack (sdata);
        );
    return TCL_ERROR;
}

Changes to tests/schema.test.

899
900
901
902
903
904
905

























906
907
908
909
910
911
912
    } {
        lappend result [s validate $xml]
    }
    s delete
    set result
} {{This method is not allowed in nested evaluation} 1 {This method is not allowed in nested evaluation} 1 {This method is not allowed in nested evaluation} 1}


























test schema-5.1 {dom parse -validateCmd} {
    set result [catch {
        [dom parse -validateCmd tdom::schema <doc/>]
    }]
} 1

test schema-5.2 {dom parse -validateCmd} {







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







899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
    } {
        lappend result [s validate $xml]
    }
    s delete
    set result
} {{This method is not allowed in nested evaluation} 1 {This method is not allowed in nested evaluation} 1 {This method is not allowed in nested evaluation} 1}

proc schema-4.5 {scmd} {
    global result
    $scmd event start foo
}

test schema-4.5 {event on itself in called script} {
    tdom::schema s
    s defelement doc {
        element a ?
        tcl schema-4.5
        element b ?
    }
    set result [list]
    foreach xml {
        <doc/>
        <doc><a/></doc>
        <doc><a/><b/></doc>
    } {
        lappend result [s validate $xml errMsg]
        lappend result $errMsg
    }
    s delete
    set result
} {0 {error "This method is not allowed in nested evaluation" at line 1 character 6} 0 {error "This method is not allowed in nested evaluation" at line 1 character 15} 0 {error "This method is not allowed in nested evaluation" at line 1 character 13}}

test schema-5.1 {dom parse -validateCmd} {
    set result [catch {
        [dom parse -validateCmd tdom::schema <doc/>]
    }]
} 1

test schema-5.2 {dom parse -validateCmd} {