tDOM

Check-in [ab18265ee0]
Login

Check-in [ab18265ee0]

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

Overview
Comment:Added the XPath step "." as allowed step in restricted schema XPath Expressions.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | localkey
Files: files | file ages | folders
SHA3-256: ab18265ee0b5ffbdab053bcdce72d6e503dc75a1851aab59ee5b383356896d55
User & Date: rolf 2019-05-22 22:22:00.615
Context
2019-05-24
12:54
Save work. Closed-Leaf check-in: 66e05a9e1a user: rolf tags: localkey
2019-05-22
22:22
Added the XPath step "." as allowed step in restricted schema XPath Expressions. check-in: ab18265ee0 user: rolf tags: localkey
2019-05-21
23:56
Save work. check-in: ddad141351 user: rolf tags: localkey
Changes
Unified Diff Ignore Whitespace Patch
Changes to generic/schema.c.
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
    int rc, hnew;
    SchemaCP *cp;
    
    /* if (toplevel) printAst (0, t); */
    while (t) {
        switch (t->type) {
        case GetContextNode:
            if (!toplevel) {
                SetResult ("Not a reduced XPath expression.");
                return 0;
            }
            t = t->next;
            continue;
        case CombineSets:
            child = t->child;
            if (child->type == EvalSteps) {
                savedt = NULL;
                child = child->child;







<
<
<
<







3826
3827
3828
3829
3830
3831
3832




3833
3834
3835
3836
3837
3838
3839
    int rc, hnew;
    SchemaCP *cp;
    
    /* if (toplevel) printAst (0, t); */
    while (t) {
        switch (t->type) {
        case GetContextNode:




            t = t->next;
            continue;
        case CombineSets:
            child = t->child;
            if (child->type == EvalSteps) {
                savedt = NULL;
                child = child->child;
Changes to tests/schema.test.
4646
4647
4648
4649
4650
4651
4652

4653
4654
4655
4656
4657
4658
4659
        {<doc><a ref="1"/><a ref="foo"/></doc>}
    } {
        lappend result [s validate $xml]
    }
    s delete
    set result
} {1 1 0 1}


test schema-19.2 {unique} {
    set schema {
        prefixns {ns1 http://tdom.org/test}
        defelement doc {
            unique ${::schema-19.2} @ref
        }







>







4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
        {<doc><a ref="1"/><a ref="foo"/></doc>}
    } {
        lappend result [s validate $xml]
    }
    s delete
    set result
} {1 1 0 1}


test schema-19.2 {unique} {
    set schema {
        prefixns {ns1 http://tdom.org/test}
        defelement doc {
            unique ${::schema-19.2} @ref
        }
4676
4677
4678
4679
4680
4681
4682


4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
        (.//b|a)/c
        ns1:a
        a/.//b/c
        {}
        {    }
        "
                "


    } {
        tdom::schema s
        lappend result [catch {s define $schema} errMsg]
        #puts $errMsg
        s delete
    }
    set result
} {0 1 1 0 0 0 1 0 0 1 1 0 1 1 0 1 1 1 1}

test schema-19.2a {unique} {
    set schema {
        prefixns {ns1 http://tdom.org/test}
        defelement doc {
            unique ${::schema-19.2} {{@ref | div/@id} @lang}
        }







>
>


|
<



|







4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688

4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
        (.//b|a)/c
        ns1:a
        a/.//b/c
        {}
        {    }
        "
                "
        ./item/./foo/.
        .
    } {
        tdom::schema s
        lappend result [catch {s define $schema}]

        s delete
    }
    set result
} {0 1 1 0 0 0 1 0 0 1 1 0 1 1 0 1 1 1 1 0 0}

test schema-19.2a {unique} {
    set schema {
        prefixns {ns1 http://tdom.org/test}
        defelement doc {
            unique ${::schema-19.2} {{@ref | div/@id} @lang}
        }