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

Overview
Comment:Merged from schema.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | wip2
Files: files | file ages | folders
SHA3-256: 4582355609955212b8bf5d9d383cf690b219e29bcf7fc59bf8a240f7fbc13161
User & Date: rolf 2020-03-14 02:49:22
Context
2020-03-14
03:24
Fixed the damn thing. Closed-Leaf check-in: 8fb5a0b988 user: rolf tags: wip2
02:49
Merged from schema. check-in: 4582355609 user: rolf tags: wip2
02:48
Gardening. check-in: 74cd3204f1 user: rolf tags: schema
2020-03-13
01:55
wip check-in: 46d498e323 user: rolf tags: wip2
Changes

Changes to generic/schema.c.

3188
3189
3190
3191
3192
3193
3194
3195
3196



3197
3198

3199
3200
3201
3202
3203
3204
3205
    if (sdata->skipDeep == 0) {
        if (node->firstAttr) {
            if (probeDomAttributes (interp, sdata, node->firstAttr) != TCL_OK) {
                return TCL_ERROR;
            }
        } else {
            if (sdata->stack->pattern->numReqAttr) {
                /* probeDomAttributes fills interp result with a msg which
                 * required attributes are missing. */



                probeDomAttributes (interp, sdata, NULL);
                return TCL_ERROR;

            }
        }
    }

    if (sdata->stack->pattern->domKeys) {
        if (checkdomKeyConstraints (interp, sdata, node) != TCL_OK)
            return TCL_ERROR;







|
|
>
>
>
|
|
>







3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
    if (sdata->skipDeep == 0) {
        if (node->firstAttr) {
            if (probeDomAttributes (interp, sdata, node->firstAttr) != TCL_OK) {
                return TCL_ERROR;
            }
        } else {
            if (sdata->stack->pattern->numReqAttr) {
                /* probeDomAttributes fills interp result with a msg
                 * which required attributes are missing in case of no
                 * reportCmd. In case of reportCmd
                 * probeDomAttributes() returns only error in the case
                 * of error in called scripts. */
                if (probeDomAttributes (interp, sdata, NULL) != TCL_OK) {
                    return TCL_ERROR;
                }
            }
        }
    }

    if (sdata->stack->pattern->domKeys) {
        if (checkdomKeyConstraints (interp, sdata, node) != TCL_OK)
            return TCL_ERROR;

Changes to tests/schema.test.

3501
3502
3503
3504
3505
3506
3507



















3508
3509
3510
3511
3512
3513
3514
        {<doc xmlns:ns1="http://foo.bar" xmlns:ns2="http://foo.grill" xmlns:ns3="http://bar.grill"><e abc="" optional="this" ns3:optional="that" def="" ghi="" jkl="" mno="" pqr="" ns2:abc="" ns1:abc="" ns3:abc=""/></doc>}
    } {
        lappend result [s validate $xml]
    }
    s delete
    set result
} {MISSING_ATTRIBUTE abc {} 1 1 MISSING_ATTRIBUTE abc http://foo.bar 1 UNKNOWN_ATTRIBUTE abc http://bar.grill 1 MISSING_ATTRIBUTE abc {} 1 1 UNKNOWN_ATTRIBUTE abc http://bar.grill 1}




















test schema-12.1 {domvalidate} {
    tdom::schema s 
    s define {
        defelement addressBook {
            element card *
        }







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







3501
3502
3503
3504
3505
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
        {<doc xmlns:ns1="http://foo.bar" xmlns:ns2="http://foo.grill" xmlns:ns3="http://bar.grill"><e abc="" optional="this" ns3:optional="that" def="" ghi="" jkl="" mno="" pqr="" ns2:abc="" ns1:abc="" ns3:abc=""/></doc>}
    } {
        lappend result [s validate $xml]
    }
    s delete
    set result
} {MISSING_ATTRIBUTE abc {} 1 1 MISSING_ATTRIBUTE abc http://foo.bar 1 UNKNOWN_ATTRIBUTE abc http://bar.grill 1 MISSING_ATTRIBUTE abc {} 1 1 UNKNOWN_ATTRIBUTE abc http://bar.grill 1}

proc schema-11.11 {scmd errType} {
    lappend ::result $errType
}
test schema-11.11 {attribute - required missing} {
    tdom::schema s
    s defelement doc {
        element a + {
            attribute mode
        }
    }
    s reportcmd schema-11.11
    set result ""
    set doc [dom parse <doc><a/></doc>]
    lappend result [s domvalidate $doc]
    $doc delete
    s delete
    set result
} {MISSING_ATTRIBUTE 1}

test schema-12.1 {domvalidate} {
    tdom::schema s 
    s define {
        defelement addressBook {
            element card *
        }