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

Overview
Comment:Fixed internal clean up after error in a content definition script with local defined elements.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | schema
Files: files | file ages | folders
SHA3-256: 8d564a17c0c2237e1d017c8bdc6d74ec675a6a4e6afecece95fbda12ac902b6d
User & Date: rolf 2020-02-13 01:19:34
Context
2020-02-19
13:22
Merged from trunk. check-in: f67995f137 user: rolf tags: schema
2020-02-13
01:19
Fixed internal clean up after error in a content definition script with local defined elements. check-in: 8d564a17c0 user: rolf tags: schema
2020-02-12
00:39
Code gardening. check-in: e7f010f104 user: rolf tags: schema
Changes

Changes to generic/schema.c.

711
712
713
714
715
716
717



718
719
720
721
722
723

724
725
726
727
728
729
730

    SchemaCP *this, *previous, *current;

    for (i = from; i < sdata->numPatternList; i++) {
        this = sdata->patternList[i];
        hashTable = NULL;
        if (this->type == SCHEMA_CTYPE_NAME) {



            if (this->flags & ELEMENTTYPE_DEF) {
                hashTable = &sdata->elementType;
                name = this->typeName;
            } else {
                hashTable = &sdata->element;
                name = this->name;

            }
        }
        if (this->type == SCHEMA_CTYPE_PATTERN) {
            hashTable = &sdata->pattern;
            name = this->name;
        }
        if (name && hashTable) {







>
>
>
|
|
|
|
|
|
>







711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734

    SchemaCP *this, *previous, *current;

    for (i = from; i < sdata->numPatternList; i++) {
        this = sdata->patternList[i];
        hashTable = NULL;
        if (this->type == SCHEMA_CTYPE_NAME) {
            /* Local defined  elements aren't saved under  their local
             * name bucket in the sdata->element hash table. */
            if (!(this->flags & LOCAL_DEFINED_ELEMENT)) {
                if (this->flags & ELEMENTTYPE_DEF) {
                    hashTable = &sdata->elementType;
                    name = this->typeName;
                } else {
                    hashTable = &sdata->element;
                    name = this->name;
                }
            }
        }
        if (this->type == SCHEMA_CTYPE_PATTERN) {
            hashTable = &sdata->pattern;
            name = this->name;
        }
        if (name && hashTable) {

Changes to tests/schema.test.

735
736
737
738
739
740
741
742




















743
744
745
746
747
748
749
            }
        }
    }
    set result [s validate <doc><e><doc><e/></doc></e></doc>]
    s delete
    set result
} 0
 




















test schema-2.1 {grammar definition: ref} {
    tdom::schema create grammar
    grammar defpattern thisPattern {
        element a
        element b
    }
    grammar defpattern thatPattern {







|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
            }
        }
    }
    set result [s validate <doc><e><doc><e/></doc></e></doc>]
    s delete
    set result
} 0

test schema-1.33 {Error after local defined element} {
    tdom::schema s
    set result [catch {
        s define {
            defelement a {
                element b ! {
                    element c ! {}
                    error "triggered"
                }
                element a ! {
                    element c ! {}
                }
                error
            }
        }
    }]
    s delete
    set result
} 1

test schema-2.1 {grammar definition: ref} {
    tdom::schema create grammar
    grammar defpattern thisPattern {
        element a
        element b
    }
    grammar defpattern thatPattern {