tDOM

Check-in [b0e429ebf8]
Login

Check-in [b0e429ebf8]

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

Overview
Comment:wip
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | localkey
Files: files | file ages | folders
SHA3-256: b0e429ebf8dbbba16704d267ddcc7c5992ba6df95ed2bfb073933aeb388c609d
User & Date: rolf 2019-05-09 14:27:04.939
Context
2019-05-09
19:16
Merged from schema. check-in: 4879bb492b user: rolf tags: localkey
14:27
wip check-in: b0e429ebf8 user: rolf tags: localkey
2019-05-07
22:52
Implementend restricted XPath expressions for local key selectors and fields. check-in: 918781e945 user: rolf tags: localkey
Changes
Unified Diff Ignore Whitespace Patch
Changes to generic/schema.c.
3322
3323
3324
3325
3326
3327
3328

3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
    ast t,
    int field,
    int toplevel
    )
{
    ast child;
    

    while (t) {
        switch (t->type) {
        case GetContextNode:
            if (!toplevel) {
                SetResult ("Not a reduced XPath expression.");
                return TCL_ERROR;
            }
            t = t->next;
            continue;
        case CombineSets:
            /* Only on top level? */
            if (!toplevel) {
                SetResult ("Not a reduced XPath expression.");
                return TCL_ERROR;
            }
            for (child = t->child; child != NULL; child = child->next) {
                if (processSchemaXPath (interp, child, field, 0) != TCL_OK) {
                    return TCL_ERROR;







>










<







3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339

3340
3341
3342
3343
3344
3345
3346
    ast t,
    int field,
    int toplevel
    )
{
    ast child;
    
    printAst (0, t);
    while (t) {
        switch (t->type) {
        case GetContextNode:
            if (!toplevel) {
                SetResult ("Not a reduced XPath expression.");
                return TCL_ERROR;
            }
            t = t->next;
            continue;
        case CombineSets:

            if (!toplevel) {
                SetResult ("Not a reduced XPath expression.");
                return TCL_ERROR;
            }
            for (child = t->child; child != NULL; child = child->next) {
                if (processSchemaXPath (interp, child, field, 0) != TCL_OK) {
                    return TCL_ERROR;
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
            if (processSchemaXPath (interp, t->child, field, 0) != TCL_OK) {
                return TCL_ERROR;
            }
        }
        toplevel = 0;
        t = t->next;
    }
    /* printAst (0, t); */
    return TCL_OK;
}

static int
uniquePatternCmd (
    ClientData clientData,
    Tcl_Interp *interp,







<







3378
3379
3380
3381
3382
3383
3384

3385
3386
3387
3388
3389
3390
3391
            if (processSchemaXPath (interp, t->child, field, 0) != TCL_OK) {
                return TCL_ERROR;
            }
        }
        toplevel = 0;
        t = t->next;
    }

    return TCL_OK;
}

static int
uniquePatternCmd (
    ClientData clientData,
    Tcl_Interp *interp,
Changes to tests/schema.test.
4165
4166
4167
4168
4169
4170
4171

4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
    foreach selector {
        a
        ./../a
        /foo
        a/b
        {a | b}
        a|b

        .//a
        //a
        a/@ref
        a/b/c
        a//b/c
        (.//b|a)/c
    } {
        set ::schema-19.2 $selector
        tdom::schema s
        lappend result [catch {s define [subst $schema]} errMsg]
        #puts $errMsg
        s delete
    }
    set result
} {0 1 1 0 0 0 0 1 1 0 1 1}

}







>














|


4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
    foreach selector {
        a
        ./../a
        /foo
        a/b
        {a | b}
        a|b
        (a|b)
        .//a
        //a
        a/@ref
        a/b/c
        a//b/c
        (.//b|a)/c
    } {
        set ::schema-19.2 $selector
        tdom::schema s
        lappend result [catch {s define [subst $schema]} errMsg]
        #puts $errMsg
        s delete
    }
    set result
} {0 1 1 0 0 0 1 0 1 1 0 1 1}

}