tDOM

Check-in [34e75df5dd]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

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

Overview
Comment:Bug fix in case of domuniqe with elements as fields.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | schema
Files: files | file ages | folders
SHA3-256: 34e75df5dd3e2a88a6d692ce172514c7ed579bda724c26a2ade62b26a0eb97a8
User & Date: rolf 2019-06-05 17:29:34
Context
2019-06-08
14:36
Work on validation error reporting. check-in: 634d7e6d48 user: rolf tags: schema
2019-06-05
17:29
Bug fix in case of domuniqe with elements as fields. check-in: 34e75df5dd user: rolf tags: schema
2019-05-31
17:00
Small editorial corrections. check-in: 09863d4ab7 user: rolf tags: schema
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/schema.c.

2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
                            break;
                        }
                        SetResult ("DOM_KEYCONSTRAINT");
                        goto errorCleanup;
                    }
                } else {
                    keystr = xpathGetStringValue (frs.nodes[0], &len);
                    Tcl_CreateHashEntry (&htable, attr->nodeValue, &hnew);
                    FREE(keystr);
                    if (!hnew) {
                        if (recover (interp, sdata, S("DOM_KEYCONSTRAINT"))) {
                            break;
                        }
                        SetResult ("DOM_KEYCONSTRAINT");
                        goto errorCleanup;






|







2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
                            break;
                        }
                        SetResult ("DOM_KEYCONSTRAINT");
                        goto errorCleanup;
                    }
                } else {
                    keystr = xpathGetStringValue (frs.nodes[0], &len);
                    Tcl_CreateHashEntry (&htable, keystr, &hnew);
                    FREE(keystr);
                    if (!hnew) {
                        if (recover (interp, sdata, S("DOM_KEYCONSTRAINT"))) {
                            break;
                        }
                        SetResult ("DOM_KEYCONSTRAINT");
                        goto errorCleanup;

Changes to tests/schema.test.

4652
4653
4654
4655
4656
4657
4658

4659
4660
4661
4662
4663
4664
4665
....
4882
4883
4884
4885
4886
4887
4888





















4889
4890
4891
    }
    return $rc
}

proc postValidation {g xml} {
    set doc [dom parse $xml]
    set rc [$g domvalidate $doc errMsg]

    $doc delete
    return $rc
}

test schema-19.1 {keyspace} {
    tdom::schema s
    s define {
................................................................................
        {<doc><item ref="1" id="a"/><item ref="1" id="b"/></doc>}
    } {
        lappend result [postValidation s $xml]
    }
    s delete
    set result
} {1 0 1 0 1}























}






>







 







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



4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
....
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
    }
    return $rc
}

proc postValidation {g xml} {
    set doc [dom parse $xml]
    set rc [$g domvalidate $doc errMsg]
    #puts "error: $errMsg"
    $doc delete
    return $rc
}

test schema-19.1 {keyspace} {
    tdom::schema s
    s define {
................................................................................
        {<doc><item ref="1" id="a"/><item ref="1" id="b"/></doc>}
    } {
        lappend result [postValidation s $xml]
    }
    s delete
    set result
} {1 0 1 0 1}

test schema-20.5 {domunique} {
    tdom::schema s
    s define {
        defelement doc {
            domunique item ref
            element item * {
                element ref ! text
            }
        }
    }
    set result [list]
    foreach xml {
        {<doc><item><ref>1</ref></item><item><ref>foo</ref></item></doc>}
        {<doc><item><ref>1</ref></item><item><ref>1</ref></item></doc>}
    } {
        lappend result [postValidation s $xml]
    }
    s delete
    set result
} {1 0}


}