Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Minor additions. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | schema |
Files: | files | file ages | folders |
SHA3-256: |
f5f54ce49b84529796a154c6db07e6bb |
User & Date: | rolf 2019-11-06 20:48:36 |
Context
2019-11-06
| ||
20:55 | Merged from trunk. check-in: 34fdc85dfb user: rolf tags: schema | |
20:48 | Minor additions. check-in: f5f54ce49b user: rolf tags: schema | |
2019-11-05
| ||
22:16 | Another attempt to get info expected right. check-in: 03f4151498 user: rolf tags: schema | |
Changes
Changes to doc/schema.xml.
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
..
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
<commanddef> <command><method>deftext</method> <m>name</m> <m><constraint script></m></command> <desc>This method defines a bundle of text constraints, that can be referred by <m>name</m> while defining constrains on text element or attribute values.</desc> </commanddef> <commanddef> <command><method>define</method> <m><definition script></m></command> <desc>This method allows to define several elements or pattern or a whole schema with one call.</desc> </commanddef> <commanddef> <command><method>start</method> <m>documentElement</m> <m>?namespace?</m></command> <desc>This method defines the name and namespace of the root element of a tree to validate. If this method is used then the root element must match for validity. If <m>start</m> isn't used, any with <m>defelement</m> defined element may be the root of a valid document. The <m>start</m> method may be used ................................................................................ serveral times with varying arguments during the lifetime of a validation command. If the command is called with just the empty string (and no namespace argument), the validation constrain for the root element is removed and any defined element will be valid as root of a tree to validate.</desc> </commanddef> <commanddef> <command><method>event</method> <m>(start|end|text)</m> <m>?event specific data?</m></command> <desc>This method allows to validate hierarchical data against the content constrains of the validation command. <optlist> <optdef> |
<
<
<
<
<
<
>
>
>
>
>
>
>
>
>
>
|
76
77
78
79
80
81
82
83
84
85
86
87
88
89
..
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
<commanddef> <command><method>deftext</method> <m>name</m> <m><constraint script></m></command> <desc>This method defines a bundle of text constraints, that can be referred by <m>name</m> while defining constrains on text element or attribute values.</desc> </commanddef> <commanddef> <command><method>start</method> <m>documentElement</m> <m>?namespace?</m></command> <desc>This method defines the name and namespace of the root element of a tree to validate. If this method is used then the root element must match for validity. If <m>start</m> isn't used, any with <m>defelement</m> defined element may be the root of a valid document. The <m>start</m> method may be used ................................................................................ serveral times with varying arguments during the lifetime of a validation command. If the command is called with just the empty string (and no namespace argument), the validation constrain for the root element is removed and any defined element will be valid as root of a tree to validate.</desc> </commanddef> <commanddef> <command><method>define</method> <m><definition script></m></command> <desc>This method allows to define several elements or pattern or a whole schema with one call. All schema command methods so far (<m>prefixns</m>, <m>defelement</m>, <m>defpattern</m>, <m>deftext</m> and <m>start</m>) are allowed top level in the <m>definition script</m>. The <m>define</m> method itself isn't allowed recursively.</desc> </commanddef> <commanddef> <command><method>event</method> <m>(start|end|text)</m> <m>?event specific data?</m></command> <desc>This method allows to validate hierarchical data against the content constrains of the validation command. <optlist> <optdef> |
Changes to generic/schema.c.
4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 |
hashTable = &sdata->pattern;
}
quant = getQuant (interp, sdata, objc == 2 ? NULL : objv[2], &n, &m);
if (quant == SCHEMA_CQUANT_ERROR) {
return TCL_ERROR;
}
h = Tcl_CreateHashEntry (hashTable,
Tcl_GetString(objv[1]), &hnew);
if (objc < 4) {
/* Reference to an element or pattern */
if (!hnew) {
pattern = (SchemaCP *) Tcl_GetHashValue (h);
while (pattern) {
if (pattern->namespace == sdata->currentNamespace) {
break;
|
| < |
4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 |
hashTable = &sdata->pattern;
}
quant = getQuant (interp, sdata, objc == 2 ? NULL : objv[2], &n, &m);
if (quant == SCHEMA_CQUANT_ERROR) {
return TCL_ERROR;
}
h = Tcl_CreateHashEntry (hashTable, Tcl_GetString(objv[1]), &hnew);
if (objc < 4) {
/* Reference to an element or pattern */
if (!hnew) {
pattern = (SchemaCP *) Tcl_GetHashValue (h);
while (pattern) {
if (pattern->namespace == sdata->currentNamespace) {
break;
|
Changes to tests/schema.test.
5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 |
} { lappend result [s validate $xml] } s delete set result } {1 s MISSING_ELEMENT 1 s MISSING_ELEMENT 1 s MISSING_ELEMENT 1 s MISSING_ELEMENT 1 s UNEXPECTED_ELEMENT 1} proc validatedSAX {g xml {keepEmpties 1}} { set args [list -validateCmd $g] if {!$keepEmpties} { lappend args -ignorewhitespace 1 } xml::parser p {*}$args set rc [catch {p parse $xml} errMsg] |
> > > > > > > > > > > > |
5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 |
} { lappend result [s validate $xml] } s delete set result } {1 s MISSING_ELEMENT 1 s MISSING_ELEMENT 1 s MISSING_ELEMENT 1 s MISSING_ELEMENT 1 s UNEXPECTED_ELEMENT 1} test schema-18.12 {non existing reportcmd cmd} { tdom::schema s s defelement doc { element a } s reportcmd ::tdom::_dontExists_ set result [catch {s validate <doc/>} errMsg] lappend result $errMsg s delete set result } {1 {error "invalid command name "::tdom::_dontExists_"" at line 1 character 6}} proc validatedSAX {g xml {keepEmpties 1}} { set args [list -validateCmd $g] if {!$keepEmpties} { lappend args -ignorewhitespace 1 } xml::parser p {*}$args set rc [catch {p parse $xml} errMsg] |