Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Added documentation to few commands, implemented earlier. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | schema |
Files: | files | file ages | folders |
SHA3-256: |
8fce09e00274b1ccacecfa8de13227d6 |
User & Date: | rolf 2019-08-23 22:56:31 |
Context
2019-10-09
| ||
16:40 | Added subcommand nextexpected to the info method of schema commands. check-in: c9fd675e9f user: rolf tags: schema | |
2019-08-24
| ||
13:27 | wip check-in: eed7c07609 user: rolf tags: wip | |
2019-08-23
| ||
22:56 | Added documentation to few commands, implemented earlier. check-in: 8fce09e002 user: rolf tags: schema | |
17:36 | Cleanly close open keyspace constraints even in case of error recovering by skiping the remaining content model of the enclosing element after validation error. Fixed interleave checking (which could miss to complained about missing childs in the interleave content). check-in: 37403bd128 user: rolf tags: schema | |
Changes
Changes to doc/schema.html.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 .. 69 70 71 72 73 74 75 76 77 78 79 80 81 82 ... 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 ... 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 ... 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 ... 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 ... 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 ... 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 |
<html> <head> <link rel="stylesheet" href="manpage.css"><title>tDOM manual: schema</title><meta name="xsl-processor" content="Jochen Loewer (loewerj@hotmail.com), Rolf Ade (rolf@pointsman.de) et. al."><meta name="generator" content="$RCSfile: tmml-html.xsl,v $ $Revision: 1.11 $"><meta charset="utf-8"> </head><body> <div class="header"> <div class="navbar" align="center"> <a href="#SECTid0x55bd61f17b30">NAME</a> · <a href="#SECTid0x55bd61f18190">SYNOPSIS</a> · <a href="#SECTid0x55bd61f12610">DESCRIPTION </a> · <a href="#SECTid0x55bd61f6f140">Schema definition scripts</a> · <a href="#SECTid0x55bd61f78080">Quantity specifier</a> · <a href="#SECTid0x55bd61f79f10">Text constraint scripts</a> · <a href="#SECTid0x55bd61f82e70">Local key constraints</a> · <a href="#SECTid0x55bd61f84c80">Exampels</a> </div><hr class="navsep"> </div><div class="body"> <h2><a name="SECTid0x55bd61f17b30">NAME</a></h2><p class="namesection"> <b class="names">tdom::schema - </b><br>Create a schema validation command</p> <h2><a name="SECTid0x55bd61f18190">SYNOPSIS</a></h2><pre class="syntax">package require tdom <b class="cmd">tdom::schema</b> <i class="m">?create?</i> <i class="m">cmdName</i> </pre> <h2><a name="SECTid0x55bd61f12610">DESCRIPTION </a></h2><p>This command creates validation commands with a simple API. The validation commands have methods to define a schema and are able to validate XML or DOM trees (and to some degree other kind of hierarchical data) against this schema.</p><p>Additionally, a validation command may be used as argument to the <i class="m">-validateCmd</i> option of the <i class="m">dom parse</i> and the <i class="m">expat</i> commands to enable validation additional to what they otherwise do.</p><p>The valid methods of the created commands are:</p><dl class="commandlist"> ................................................................................ argument is given, any <i class="m">element</i> or <i class="m">ref</i> references in the definition script not wrapped inside a <i class="m">namespace</i> command are resolved in that namespace. If there is already a pattern definition for the name/namespace combination the command raises error.</dd> <dt> <b class="method">define</b> <i class="m"><definition script></i> </dt> <dd>This method allows to define several elements or pattern or a whole schema with one call.</dd> ................................................................................ <dt><b class="method">reset</b></dt> <dd>This method resets the validation command into state READY (while preserving the defined grammer).</dd> </dl> <h2><a name="SECTid0x55bd61f6f140">Schema definition scripts</a></h2><p>Schema definition scripts are ordinary Tcl scripts that are evaluatend in the namespace tdom::schema. The below listed schema definition commands in this tcl namespace allow to define a wide variety of document structures. Every schema definition command establish a validation constraint on the content which has to match or must be optional to render the content as valid. It is a validation error if the element in the XML source has additional (not matched) content.</p><p>The schema definition commands are:</p><dl class="commandlist"> ................................................................................ text type name.</dd> <dt> <b class="method">nsattribute</b> <i class="m">name</i> <i class="m">namespace</i> <i class="m">?quant?</i> <i class="m">(?<constraint script>|"type" typename?)</i> </dt> <dd>This command does the same as the command <i class="m">attribute</i>, just for the attribute <i class="m">name</i> in the namespace <i class="m">namespace</i>.</dd> <dt> <b class="method">namespace</b> <i class="m">uri</i> <i class="m"><definition script></i> </dt> <dd>Evaluates the <i class="m">definition script</i> with context namespace <i class="m">uri</i>. Every element or ref command name will be looked up in the namespace <i class="m">uri</i> and local defined element will be in that namespace.</dd> <dt> <b class="method">prefixns</b> <i class="m">?prefixUriList?</i> </dt> <dd>This defines a prefix to namespace URI mapping exactly ................................................................................ <dd>This defines a named pattern exactly as a <i>schemacmd defpattern</i> call. This is meant as toplevel command of a <i>schemacmd define</i> script. This command is not allowed nested in an other definition script command and will raise error, if you call it there.</dd> <dt> <b class="method">start</b> <i class="m">name</i> <i class="m">?namespace?</i> </dt> <dd>This command works exactly as a <i>schemacmd start</i> call. This is meant as toplevel command of a <i>schemacmd define</i> script. This command is not allowed nested in an other definition script command and will raise error, if you call it there.</dd> </dl> <h2><a name="SECTid0x55bd61f78080">Quantity specifier</a></h2><p>Serveral schema definition commands expects a quantifier as one of their arguments, which specifies how often the content particle specified by the command is expected. The valid values for a <i class="m">quant</i> argument are:</p><dl class="optlist"> <dt><b>!</b></dt> <dd>The content particle must occur exactly once in valid documents. This is the default, if a quantifier is ................................................................................ n to m times (both inclusive) in a row in valid documents. The quantifier must be a tcl list with two elements. Both elements must be integers, with n >= 0 and n < m.</dd> </dl><p>If an optional quantifier is not given then it defaults to * in case of the mixed command and to ! for all other commands.</p> <h2><a name="SECTid0x55bd61f79f10">Text constraint scripts</a></h2><p>Text - parsed character data, as XML calles it - must sometimes have to be of a certain kind, must comply to some rules etc to be valid.</p><p>The text constraint commands are:</p><dl class="commandlist"> <dt> <b class="cmd">integer</b> <i class="m">?(xsd|tcl)?</i> </dt> <dd>This text constraint match if the text value could be parsed as an integer. If the optional argument to the command is <i class="m">tcl</i> everthing that returns TCL_OK if feeded into ................................................................................ <dt> <b class="cmd">tcl</b> <i class="m">tclcmd</i> <i class="m">?arg arg ...?</i> </dt> <dd>Evaluates the tcl script <i class="m">tclcmd arg arg ... </i> and the text to validate appended to the argument list. The return value of the tcl command is interpreted as a boolean.</dd> <dt> <b class="cmd">enumeration</b> <i class="m">list</i> </dt> <dd>This text constraint match if the text value is equal to one element (respecting case and any whitespace) of the argument <i class="m">list</i>, which has to be a valid Tcl list. </dd> <dt> <b class="cmd">match</b> <i class="m">?-nocase?</i> <i class="m">glob style match pattern</i> </dt> <dd>This text constraint match if the text value match the glob style pattern given as argument. It follows the rules of the Tcl [string match] command, see <a href="https://www.tcl.tk/man/tcl8.6/TclCmd/string.htm#M35">https://www.tcl.tk/man/tcl8.6/TclCmd/string.htm#M35</a>.</dd> ................................................................................ <dt><b class="cmd">base64</b></dt> <dd>This text constraint match if text is valid according to RFC 4648.</dd> </dl> <h2><a name="SECTid0x55bd61f82e70">Local key constraints</a></h2><p>Document wide uniqueness and foreign key constraints are available with the text constraint commands id and idref. Keyspaces allow for sub-tree local uniqueness and foreign key constraints.</p><dl class="commandlist"> <dt> <b class="cmd">keyspace</b> <i class="m">names list></i> <i class="m"><constraint script></i> </dt> <dd>Any number of keyspaces are possible. A keyspace is either active or not. An inside a <i class="m">constraint script></i> called keyspace with the same name does nothing.</dd> </dl><p>This text constraint commands work with keyspaces:</p><dl class="commandlist"> <dt> <b class="cmd">key</b> <i class="m">name></i> </dt> <dd>If the keyspace with the name <i class="m">name></i> is not active always matches. If the keyspace is active then reports error if there is already a key with the value. Otherwise, stores the value as key in this keyspace and matches.</dd> <dt> <b class="cmd">keyref</b> <i class="m">name></i> </dt> <dd>If the keyspace with the name <i class="m">name></i> is not active always matches. If the keyspace is active then reports error if there is still no key as the value at the end of the keyspace <i class="m">name></i>. Otherwise it matches.</dd> </dl> <h2><a name="SECTid0x55bd61f84c80">Exampels</a></h2><p>The XML Schema Part 0: Primer Second Edition (<a href="https://www.w3.org/TR/xmlschema-0/">https://www.w3.org/TR/xmlschema-0/</a>) starts with this example schema:</p><pre class="example"> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:annotation> <xsd:documentation xml:lang="en"> Purchase order schema for Example.com. |
| | | | > > > > > > > > > | > | > > | > > > > > > > > > > > > > > > > > > > > > > > > > | | > > | > | | | | | | | | | |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 .. 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 ... 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 ... 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 ... 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 ... 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 ... 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 ... 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 |
<html> <head> <link rel="stylesheet" href="manpage.css"><title>tDOM manual: schema</title><meta name="xsl-processor" content="Jochen Loewer (loewerj@hotmail.com), Rolf Ade (rolf@pointsman.de) et. al."><meta name="generator" content="$RCSfile: tmml-html.xsl,v $ $Revision: 1.11 $"><meta charset="utf-8"> </head><body> <div class="header"> <div class="navbar" align="center"> <a href="#SECTid0x56063934db40">NAME</a> · <a href="#SECTid0x56063934e1a0">SYNOPSIS</a> · <a href="#SECTid0x560639348610">DESCRIPTION </a> · <a href="#SECTid0x5606393a58d0">Schema definition scripts</a> · <a href="#SECTid0x5606393af9a0">Quantity specifier</a> · <a href="#SECTid0x5606393b1830">Text constraint scripts</a> · <a href="#SECTid0x5606393ba860">Local key constraints</a> · <a href="#SECTid0x5606393bc670">Exampels</a> </div><hr class="navsep"> </div><div class="body"> <h2><a name="SECTid0x56063934db40">NAME</a></h2><p class="namesection"> <b class="names">tdom::schema - </b><br>Create a schema validation command</p> <h2><a name="SECTid0x56063934e1a0">SYNOPSIS</a></h2><pre class="syntax">package require tdom <b class="cmd">tdom::schema</b> <i class="m">?create?</i> <i class="m">cmdName</i> </pre> <h2><a name="SECTid0x560639348610">DESCRIPTION </a></h2><p>This command creates validation commands with a simple API. The validation commands have methods to define a schema and are able to validate XML or DOM trees (and to some degree other kind of hierarchical data) against this schema.</p><p>Additionally, a validation command may be used as argument to the <i class="m">-validateCmd</i> option of the <i class="m">dom parse</i> and the <i class="m">expat</i> commands to enable validation additional to what they otherwise do.</p><p>The valid methods of the created commands are:</p><dl class="commandlist"> ................................................................................ argument is given, any <i class="m">element</i> or <i class="m">ref</i> references in the definition script not wrapped inside a <i class="m">namespace</i> command are resolved in that namespace. If there is already a pattern definition for the name/namespace combination the command raises error.</dd> <dt> <b class="method">deftext</b> <i class="m">name</i> <i class="m"><constraint script></i> </dt> <dd>This method defines a bundle of text constraints, that can be referred by <i class="m">name</i> while defining constrains on text element or attribute values.</dd> <dt> <b class="method">define</b> <i class="m"><definition script></i> </dt> <dd>This method allows to define several elements or pattern or a whole schema with one call.</dd> ................................................................................ <dt><b class="method">reset</b></dt> <dd>This method resets the validation command into state READY (while preserving the defined grammer).</dd> </dl> <h2><a name="SECTid0x5606393a58d0">Schema definition scripts</a></h2><p>Schema definition scripts are ordinary Tcl scripts that are evaluatend in the namespace tdom::schema. The below listed schema definition commands in this tcl namespace allow to define a wide variety of document structures. Every schema definition command establish a validation constraint on the content which has to match or must be optional to render the content as valid. It is a validation error if the element in the XML source has additional (not matched) content.</p><p>The schema definition commands are:</p><dl class="commandlist"> ................................................................................ text type name.</dd> <dt> <b class="method">nsattribute</b> <i class="m">name</i> <i class="m">namespace</i> <i class="m">?quant?</i> <i class="m">(?<constraint script>|"type" typename?)</i> </dt> <dd>This command does the same as the command <i class="m">attribute</i>, just for the attribute <i class="m">name</i> in the namespace <i class="m">namespace</i>.</dd> <dt> <b class="method">namespace</b> <i class="m">uri</i> <i class="m"><definition script></i> </dt> <dd>Evaluates the <i class="m">definition script</i> with context namespace <i class="m">uri</i>. Every element or ref command name will be looked up in the namespace <i class="m">uri</i> and local defined element will be in that namespace.</dd> <dt> <b class="method">tcl</b> <i class="m">tclcmd</i> <i class="m">?arg arg ...?</i> </dt> <dd>Evaluates the Tcl script <i class="m">tclcmd arg arg ... </i> and the schema command appended to the argument list. This validation command is only allowed in strict sequential context (not in choice, mixed and interleave). If the return code is something else than 0 (TCL_OK) then this ia a validation error.</dd> <dt> <b class="method">prefixns</b> <i class="m">?prefixUriList?</i> </dt> <dd>This defines a prefix to namespace URI mapping exactly ................................................................................ <dd>This defines a named pattern exactly as a <i>schemacmd defpattern</i> call. This is meant as toplevel command of a <i>schemacmd define</i> script. This command is not allowed nested in an other definition script command and will raise error, if you call it there.</dd> <dt> <b class="method">deftext</b> <i class="m">name</i> <i class="m"><constraint script></i> </dt> <dd>This defines a named bundle of text constraints exactly as a <i>schemacmd deftext</i> call. This is meant as toplevel command of a <i>schemacmd define</i> script. This command is not allowed nested in an other definition script command and will raise error, if you call it there.</dd> <dt> <b class="method">start</b> <i class="m">name</i> <i class="m">?namespace?</i> </dt> <dd>This command works exactly as a <i>schemacmd start</i> call. This is meant as toplevel command of a <i>schemacmd define</i> script. This command is not allowed nested in an other definition script command and will raise error, if you call it there.</dd> </dl> <h2><a name="SECTid0x5606393af9a0">Quantity specifier</a></h2><p>Serveral schema definition commands expects a quantifier as one of their arguments, which specifies how often the content particle specified by the command is expected. The valid values for a <i class="m">quant</i> argument are:</p><dl class="optlist"> <dt><b>!</b></dt> <dd>The content particle must occur exactly once in valid documents. This is the default, if a quantifier is ................................................................................ n to m times (both inclusive) in a row in valid documents. The quantifier must be a tcl list with two elements. Both elements must be integers, with n >= 0 and n < m.</dd> </dl><p>If an optional quantifier is not given then it defaults to * in case of the mixed command and to ! for all other commands.</p> <h2><a name="SECTid0x5606393b1830">Text constraint scripts</a></h2><p>Text - parsed character data, as XML calles it - must sometimes have to be of a certain kind, must comply to some rules etc to be valid. The text constraint script arguments to the text, attribute, nsattribute and deftext commands allow the following text constraint commands to check text for certain properties.</p><p>The text constraint commands are:</p><dl class="commandlist"> <dt> <b class="cmd">integer</b> <i class="m">?(xsd|tcl)?</i> </dt> <dd>This text constraint match if the text value could be parsed as an integer. If the optional argument to the command is <i class="m">tcl</i> everthing that returns TCL_OK if feeded into ................................................................................ <dt> <b class="cmd">tcl</b> <i class="m">tclcmd</i> <i class="m">?arg arg ...?</i> </dt> <dd>Evaluates the tcl script <i class="m">tclcmd arg arg ... </i> and the text to validate appended to the argument list. The return value of the tcl command is interpreted as a boolean.</dd> <dt> <b class="cmd">enumeration</b> <i class="m">list</i> </dt> <dd>This text constraint match if the text value is equal to one element (respecting case and any whitespace) of the argument <i class="m">list</i>, which has to be a valid Tcl list. </dd> <dt> <b class="cmd">match</b> <i class="m">?-nocase?</i> <i class="m">glob_style_match_pattern></i> </dt> <dd>This text constraint match if the text value match the glob style pattern given as argument. It follows the rules of the Tcl [string match] command, see <a href="https://www.tcl.tk/man/tcl8.6/TclCmd/string.htm#M35">https://www.tcl.tk/man/tcl8.6/TclCmd/string.htm#M35</a>.</dd> ................................................................................ <dt><b class="cmd">base64</b></dt> <dd>This text constraint match if text is valid according to RFC 4648.</dd> </dl> <h2><a name="SECTid0x5606393ba860">Local key constraints</a></h2><p>Document wide uniqueness and foreign key constraints are available with the text constraint commands id and idref. Keyspaces allow for sub-tree local uniqueness and foreign key constraints.</p><dl class="commandlist"> <dt> <b class="cmd">keyspace</b> <i class="m"><names list></i> <i class="m"><constraint script></i> </dt> <dd>Any number of keyspaces are possible. A keyspace is either active or not. An inside a <i class="m">constraint script></i> called keyspace with the same name does nothing.</dd> </dl><p>This text constraint commands work with keyspaces:</p><dl class="commandlist"> <dt> <b class="cmd">key</b> <i class="m"><name></i> </dt> <dd>If the keyspace with the name <i class="m"><name></i> is not active always matches. If the keyspace is active then reports error if there is already a key with the value. Otherwise, stores the value as key in this keyspace and matches.</dd> <dt> <b class="cmd">keyref</b> <i class="m"><name></i> </dt> <dd>If the keyspace with the name <i class="m"><name></i> is not active always matches. If the keyspace is active then reports error if there is still no key as the value at the end of the keyspace <i class="m"><name></i>. Otherwise it matches.</dd> </dl> <h2><a name="SECTid0x5606393bc670">Exampels</a></h2><p>The XML Schema Part 0: Primer Second Edition (<a href="https://www.w3.org/TR/xmlschema-0/">https://www.w3.org/TR/xmlschema-0/</a>) starts with this example schema:</p><pre class="example"> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:annotation> <xsd:documentation xml:lang="en"> Purchase order schema for Example.com. |
Changes to doc/schema.n.
216 217 218 219 220 221 222 223 224 225 226 227 228 229 ... 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 ... 398 399 400 401 402 403 404 405 406 407 408 409 410 411 ... 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 ... 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 ... 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 |
\&\fIdefinition script\fR is evaluated and defines the content model of the content particle. If the \fInamespace\fR argument is given, any \fIelement\fR or \fIref\fR references in the definition script not wrapped inside a \fInamespace\fR command are resolved in that namespace. If there is already a pattern definition for the name/namespace combination the command raises error. .TP \&\fB\fBdefine\fP \fI<definition script>\fB \&\fRThis method allows to define several elements or pattern or a whole schema with one call. .TP \&\fB\fBstart\fP \fIdocumentElement\fB \fI?namespace?\fB \&\fRThis method defines the name and namespace of the root ................................................................................ is one argument more this argument is evaluated as constraint script, defining the value constrains of the attribute. Otherwise, if there are two more arguments and the first of them is the bareword "type" then the following is used as a text type name. .TP \&\fB\fBnsattribute\fP \fIname\fB \fInamespace\fB \fI?quant?\fB \fI(?<constraint script>|\*(lqtype\*(lq typename?)\fB \&\fRThis command does the same as the command \fIattribute\fR, just for the attribute \fIname\fR in the namespace \fInamespace\fR. .TP \&\fB\fBnamespace\fP \fIuri\fB \fI<definition script>\fB \&\fREvaluates the \fIdefinition script\fR with context namespace \fIuri\fR. Every element or ref command name will be looked up in the namespace \fIuri\fR and local defined element will be in that namespace. .TP \&\fB\fBprefixns\fP \fI?prefixUriList?\fB \&\fRThis defines a prefix to namespace URI mapping exactly as a \fIschemacmd prefixns\fR call. This is meant as toplevel command of a \fIschemacmd define\fR script. This command is not allowed nested in an other definition script command and will raise error, if you call it there. ................................................................................ .TP \&\fB\fBdefpattern\fP \fIname\fB \fI?namespace?\fB \fI<definition script>\fB \&\fRThis defines a named pattern exactly as a \fIschemacmd defpattern\fR call. This is meant as toplevel command of a \&\fIschemacmd define\fR script. This command is not allowed nested in an other definition script command and will raise error, if you call it there. .TP \&\fB\fBstart\fP \fIname\fB \fI?namespace?\fB \&\fRThis command works exactly as a \fIschemacmd start\fR call. This is meant as toplevel command of a \fIschemacmd define\fR script. This command is not allowed nested in an other definition script command and will raise error, if you call it there. ................................................................................ .PP If an optional quantifier is not given then it defaults to * in case of the mixed command and to ! for all other commands. .SH "Text constraint scripts" .PP Text - parsed character data, as XML calles it - must sometimes have to be of a certain kind, must comply to some rules etc to be valid. .PP The text constraint commands are: .TP \&\fB\fBinteger\fP \fI?(xsd|tcl)?\fB \&\fRThis text constraint match if the text value could be parsed as an integer. If the optional argument to the command is \fItcl\fR everthing that returns TCL_OK if feeded into ................................................................................ value of the tcl command is interpreted as a boolean. .TP \&\fB\fBenumeration\fP \fIlist\fB \&\fRThis text constraint match if the text value is equal to one element (respecting case and any whitespace) of the argument \fIlist\fR, which has to be a valid Tcl list. .TP \&\fB\fBmatch\fP \fI?-nocase?\fB \fIglob style match pattern\fB .UR "https://www.tcl.tk/man/tcl8.6/TclCmd/string.htm#M35" <URL: https://www.tcl.tk/man/tcl8.6/TclCmd/string.htm#M35> .UE \&\fRThis text constraint match if the text value match the glob style pattern given as argument. It follows the rules of the Tcl [string match] command, see \&. ................................................................................ .SH "Local key constraints" .PP Document wide uniqueness and foreign key constraints are available with the text constraint commands id and idref. Keyspaces allow for sub-tree local uniqueness and foreign key constraints. .TP \&\fB\fBkeyspace\fP \fInames list>\fB \fI<constraint script>\fB \&\fRAny number of keyspaces are possible. A keyspace is either active or not. An inside a \fIconstraint script>\fR called keyspace with the same name does nothing. .PP This text constraint commands work with keyspaces: .TP \&\fB\fBkey\fP \fIname>\fB \&\fRIf the keyspace with the name \fIname>\fR is not active always matches. If the keyspace is active then reports error if there is already a key with the value. Otherwise, stores the value as key in this keyspace and matches. .TP \&\fB\fBkeyref\fP \fIname>\fB \&\fRIf the keyspace with the name \fIname>\fR is not active always matches. If the keyspace is active then reports error if there is still no key as the value at the end of the keyspace \fIname>\fR. Otherwise it matches. .SH Exampels .PP .UR "https://www.w3.org/TR/xmlschema-0/" <URL: https://www.w3.org/TR/xmlschema-0/> .UE The XML Schema Part 0: Primer Second Edition |
> > > > > > | > > | > > > > > > > > > > > > > > > > > | > > | | | | | | | |
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 ... 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 ... 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 ... 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 ... 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 ... 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 |
\&\fIdefinition script\fR is evaluated and defines the content model of the content particle. If the \fInamespace\fR argument is given, any \fIelement\fR or \fIref\fR references in the definition script not wrapped inside a \fInamespace\fR command are resolved in that namespace. If there is already a pattern definition for the name/namespace combination the command raises error. .TP \&\fB\fBdeftext\fP \fIname\fB \fI<constraint script>\fB \&\fRThis method defines a bundle of text constraints, that can be referred by \fIname\fR while defining constrains on text element or attribute values. .TP \&\fB\fBdefine\fP \fI<definition script>\fB \&\fRThis method allows to define several elements or pattern or a whole schema with one call. .TP \&\fB\fBstart\fP \fIdocumentElement\fB \fI?namespace?\fB \&\fRThis method defines the name and namespace of the root ................................................................................ is one argument more this argument is evaluated as constraint script, defining the value constrains of the attribute. Otherwise, if there are two more arguments and the first of them is the bareword "type" then the following is used as a text type name. .TP \&\fB\fBnsattribute\fP \fIname\fB \fInamespace\fB \fI?quant?\fB \fI(?<constraint script>|\*(lqtype\*(lq typename?)\fB \&\fRThis command does the same as the command \&\fIattribute\fR, just for the attribute \fIname\fR in the namespace \fInamespace\fR. .TP \&\fB\fBnamespace\fP \fIuri\fB \fI<definition script>\fB \&\fREvaluates the \fIdefinition script\fR with context namespace \fIuri\fR. Every element or ref command name will be looked up in the namespace \fIuri\fR and local defined element will be in that namespace. .TP \&\fB\fBtcl\fP \fItclcmd\fB \fI?arg arg ...?\fB \&\fREvaluates the Tcl script \fItclcmd arg arg ... \fR and the schema command appended to the argument list. This validation command is only allowed in strict sequential context (not in choice, mixed and interleave). If the return code is something else than 0 (TCL_OK) then this ia a validation error. .TP \&\fB\fBprefixns\fP \fI?prefixUriList?\fB \&\fRThis defines a prefix to namespace URI mapping exactly as a \fIschemacmd prefixns\fR call. This is meant as toplevel command of a \fIschemacmd define\fR script. This command is not allowed nested in an other definition script command and will raise error, if you call it there. ................................................................................ .TP \&\fB\fBdefpattern\fP \fIname\fB \fI?namespace?\fB \fI<definition script>\fB \&\fRThis defines a named pattern exactly as a \fIschemacmd defpattern\fR call. This is meant as toplevel command of a \&\fIschemacmd define\fR script. This command is not allowed nested in an other definition script command and will raise error, if you call it there. .TP \&\fB\fBdeftext\fP \fIname\fB \fI<constraint script>\fB \&\fRThis defines a named bundle of text constraints exactly as a \fIschemacmd deftext\fR call. This is meant as toplevel command of a \fIschemacmd define\fR script. This command is not allowed nested in an other definition script command and will raise error, if you call it there. .TP \&\fB\fBstart\fP \fIname\fB \fI?namespace?\fB \&\fRThis command works exactly as a \fIschemacmd start\fR call. This is meant as toplevel command of a \fIschemacmd define\fR script. This command is not allowed nested in an other definition script command and will raise error, if you call it there. ................................................................................ .PP If an optional quantifier is not given then it defaults to * in case of the mixed command and to ! for all other commands. .SH "Text constraint scripts" .PP Text - parsed character data, as XML calles it - must sometimes have to be of a certain kind, must comply to some rules etc to be valid. The text constraint script arguments to the text, attribute, nsattribute and deftext commands allow the following text constraint commands to check text for certain properties. .PP The text constraint commands are: .TP \&\fB\fBinteger\fP \fI?(xsd|tcl)?\fB \&\fRThis text constraint match if the text value could be parsed as an integer. If the optional argument to the command is \fItcl\fR everthing that returns TCL_OK if feeded into ................................................................................ value of the tcl command is interpreted as a boolean. .TP \&\fB\fBenumeration\fP \fIlist\fB \&\fRThis text constraint match if the text value is equal to one element (respecting case and any whitespace) of the argument \fIlist\fR, which has to be a valid Tcl list. .TP \&\fB\fBmatch\fP \fI?-nocase?\fB \fIglob_style_match_pattern>\fB .UR "https://www.tcl.tk/man/tcl8.6/TclCmd/string.htm#M35" <URL: https://www.tcl.tk/man/tcl8.6/TclCmd/string.htm#M35> .UE \&\fRThis text constraint match if the text value match the glob style pattern given as argument. It follows the rules of the Tcl [string match] command, see \&. ................................................................................ .SH "Local key constraints" .PP Document wide uniqueness and foreign key constraints are available with the text constraint commands id and idref. Keyspaces allow for sub-tree local uniqueness and foreign key constraints. .TP \&\fB\fBkeyspace\fP \fI<names list>\fB \fI<constraint script>\fB \&\fRAny number of keyspaces are possible. A keyspace is either active or not. An inside a \fIconstraint script>\fR called keyspace with the same name does nothing. .PP This text constraint commands work with keyspaces: .TP \&\fB\fBkey\fP \fI<name>\fB \&\fRIf the keyspace with the name \fI<name>\fR is not active always matches. If the keyspace is active then reports error if there is already a key with the value. Otherwise, stores the value as key in this keyspace and matches. .TP \&\fB\fBkeyref\fP \fI<name>\fB \&\fRIf the keyspace with the name \fI<name>\fR is not active always matches. If the keyspace is active then reports error if there is still no key as the value at the end of the keyspace \fI<name>\fR. Otherwise it matches. .SH Exampels .PP .UR "https://www.w3.org/TR/xmlschema-0/" <URL: https://www.w3.org/TR/xmlschema-0/> .UE The XML Schema Part 0: Primer Second Edition |
Changes to doc/schema.xml.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 ... 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 ... 314 315 316 317 318 319 320 321 322 323 324 325 326 327 ... 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 ... 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 ... 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 |
argument is given, any <m>element</m> or <m>ref</m> references in the definition script not wrapped inside a <m>namespace</m> command are resolved in that namespace. If there is already a pattern definition for the name/namespace combination the command raises error.</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> ................................................................................ Otherwise, if there are two more arguments and the first of them is the bareword "type" then the following is used as a text type name.</desc> </commanddef> <commanddef> <command><method>nsattribute</method> <m>name</m> <m>namespace</m> <m>?quant?</m> <m>(?<constraint script>|"type" typename?)</m></command> <desc>This command does the same as the command <m>attribute</m>, just for the attribute <m>name</m> in the namespace <m>namespace</m>.</desc> </commanddef> <commanddef> <command><method>namespace</method> <m>uri</m> <m><definition script></m></command> <desc>Evaluates the <m>definition script</m> with context namespace <m>uri</m>. Every element or ref command name will be looked up in the namespace <m>uri</m> and local defined element will be in that namespace.</desc> </commanddef> <commanddef> <command><method>prefixns</method> <m>?prefixUriList?</m></command> <desc>This defines a prefix to namespace URI mapping exactly as a <i>schemacmd prefixns</i> call. This is meant as toplevel command of a <i>schemacmd define</i> script. This command is ................................................................................ <desc>This defines a named pattern exactly as a <i>schemacmd defpattern</i> call. This is meant as toplevel command of a <i>schemacmd define</i> script. This command is not allowed nested in an other definition script command and will raise error, if you call it there.</desc> </commanddef> <commanddef> <command><method>start</method> <m>name</m> <m>?namespace?</m></command> <desc>This command works exactly as a <i>schemacmd start</i> call. This is meant as toplevel command of a <i>schemacmd define</i> script. This command is not allowed nested in an other definition script command and will raise error, if you call it there.</desc> ................................................................................ </section> <section> <title>Text constraint scripts</title> <p>Text - parsed character data, as XML calles it - must sometimes have to be of a certain kind, must comply to some rules etc to be valid.</p> <p>The text constraint commands are:</p> <commandlist> <commanddef> <command><cmd>integer</cmd> <m>?(xsd|tcl)?</m></command> <desc>This text constraint match if the text value could be ................................................................................ <commanddef> <command><cmd>tcl</cmd> <m>tclcmd</m> <m>?arg arg ...?</m></command> <desc>Evaluates the tcl script <m>tclcmd arg arg ... </m> and the text to validate appended to the argument list. The return value of the tcl command is interpreted as a boolean.</desc> </commanddef> <commanddef> <command><cmd>enumeration</cmd> <m>list</m></command> <desc>This text constraint match if the text value is equal to one element (respecting case and any whitespace) of the argument <m>list</m>, which has to be a valid Tcl list. </desc> </commanddef> <commanddef> <command><cmd>match</cmd> <m>?-nocase?</m> <m>glob style match pattern</m></command> <desc>This text constraint match if the text value match the glob style pattern given as argument. It follows the rules of the Tcl [string match] command, see <url>https://www.tcl.tk/man/tcl8.6/TclCmd/string.htm#M35</url>.</desc> </commanddef> <commanddef> <command><cmd>regexp</cmd> <m>expression</m></command> ................................................................................ <p>Document wide uniqueness and foreign key constraints are available with the text constraint commands id and idref. Keyspaces allow for sub-tree local uniqueness and foreign key constraints.</p> <commandlist> <commanddef> <command><cmd>keyspace</cmd> <m>&kt;names list></m> <m><constraint script></m></command> <desc>Any number of keyspaces are possible. A keyspace is either active or not. An inside a <m>constraint script></m> called keyspace with the same name does nothing.</desc> </commanddef> </commandlist> <p>This text constraint commands work with keyspaces:</p> <commandlist> <commanddef> <command><cmd>key</cmd> <m>name></m></command> <desc>If the keyspace with the name <m>name></m> is not active always matches. If the keyspace is active then reports error if there is already a key with the value. Otherwise, stores the value as key in this keyspace and matches.</desc> </commanddef> <commanddef> <command><cmd>keyref</cmd> <m>name></m></command> <desc>If the keyspace with the name <m>name></m> is not active always matches. If the keyspace is active then reports error if there is still no key as the value at the end of the keyspace <m>name></m>. Otherwise it matches.</desc> </commanddef> </commandlist> </section> <section> |
> > > > > > > > | > > | > > > > > > > > > > > > > > > > > > > > > | > > > | | | | | | | |
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 ... 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 ... 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 ... 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 ... 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 ... 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 |
argument is given, any <m>element</m> or <m>ref</m> references in the definition script not wrapped inside a <m>namespace</m> command are resolved in that namespace. If there is already a pattern definition for the name/namespace combination the command raises error.</desc> </commanddef> <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> ................................................................................ Otherwise, if there are two more arguments and the first of them is the bareword "type" then the following is used as a text type name.</desc> </commanddef> <commanddef> <command><method>nsattribute</method> <m>name</m> <m>namespace</m> <m>?quant?</m> <m>(?<constraint script>|"type" typename?)</m></command> <desc>This command does the same as the command <m>attribute</m>, just for the attribute <m>name</m> in the namespace <m>namespace</m>.</desc> </commanddef> <commanddef> <command><method>namespace</method> <m>uri</m> <m><definition script></m></command> <desc>Evaluates the <m>definition script</m> with context namespace <m>uri</m>. Every element or ref command name will be looked up in the namespace <m>uri</m> and local defined element will be in that namespace.</desc> </commanddef> <commanddef> <command><method>tcl</method> <m>tclcmd</m> <m>?arg arg ...?</m></command> <desc>Evaluates the Tcl script <m>tclcmd arg arg ... </m> and the schema command appended to the argument list. This validation command is only allowed in strict sequential context (not in choice, mixed and interleave). If the return code is something else than 0 (TCL_OK) then this ia a validation error.</desc> </commanddef> <commanddef> <command><method>prefixns</method> <m>?prefixUriList?</m></command> <desc>This defines a prefix to namespace URI mapping exactly as a <i>schemacmd prefixns</i> call. This is meant as toplevel command of a <i>schemacmd define</i> script. This command is ................................................................................ <desc>This defines a named pattern exactly as a <i>schemacmd defpattern</i> call. This is meant as toplevel command of a <i>schemacmd define</i> script. This command is not allowed nested in an other definition script command and will raise error, if you call it there.</desc> </commanddef> <commanddef> <command><method>deftext</method> <m>name</m> <m><constraint script></m></command> <desc>This defines a named bundle of text constraints exactly as a <i>schemacmd deftext</i> call. This is meant as toplevel command of a <i>schemacmd define</i> script. This command is not allowed nested in an other definition script command and will raise error, if you call it there.</desc> </commanddef> <commanddef> <command><method>start</method> <m>name</m> <m>?namespace?</m></command> <desc>This command works exactly as a <i>schemacmd start</i> call. This is meant as toplevel command of a <i>schemacmd define</i> script. This command is not allowed nested in an other definition script command and will raise error, if you call it there.</desc> ................................................................................ </section> <section> <title>Text constraint scripts</title> <p>Text - parsed character data, as XML calles it - must sometimes have to be of a certain kind, must comply to some rules etc to be valid. The text constraint script arguments to the text, attribute, nsattribute and deftext commands allow the following text constraint commands to check text for certain properties.</p> <p>The text constraint commands are:</p> <commandlist> <commanddef> <command><cmd>integer</cmd> <m>?(xsd|tcl)?</m></command> <desc>This text constraint match if the text value could be ................................................................................ <commanddef> <command><cmd>tcl</cmd> <m>tclcmd</m> <m>?arg arg ...?</m></command> <desc>Evaluates the tcl script <m>tclcmd arg arg ... </m> and the text to validate appended to the argument list. The return value of the tcl command is interpreted as a boolean.</desc> </commanddef> <commanddef> <command><cmd>enumeration</cmd> <m>list</m></command> <desc>This text constraint match if the text value is equal to one element (respecting case and any whitespace) of the argument <m>list</m>, which has to be a valid Tcl list. </desc> </commanddef> <commanddef> <command><cmd>match</cmd> <m>?-nocase?</m> <m>glob_style_match_pattern></m></command> <desc>This text constraint match if the text value match the glob style pattern given as argument. It follows the rules of the Tcl [string match] command, see <url>https://www.tcl.tk/man/tcl8.6/TclCmd/string.htm#M35</url>.</desc> </commanddef> <commanddef> <command><cmd>regexp</cmd> <m>expression</m></command> ................................................................................ <p>Document wide uniqueness and foreign key constraints are available with the text constraint commands id and idref. Keyspaces allow for sub-tree local uniqueness and foreign key constraints.</p> <commandlist> <commanddef> <command><cmd>keyspace</cmd> <m><names list></m> <m><constraint script></m></command> <desc>Any number of keyspaces are possible. A keyspace is either active or not. An inside a <m>constraint script></m> called keyspace with the same name does nothing.</desc> </commanddef> </commandlist> <p>This text constraint commands work with keyspaces:</p> <commandlist> <commanddef> <command><cmd>key</cmd> <m><name></m></command> <desc>If the keyspace with the name <m><name></m> is not active always matches. If the keyspace is active then reports error if there is already a key with the value. Otherwise, stores the value as key in this keyspace and matches.</desc> </commanddef> <commanddef> <command><cmd>keyref</cmd> <m><name></m></command> <desc>If the keyspace with the name <m><name></m> is not active always matches. If the keyspace is active then reports error if there is still no key as the value at the end of the keyspace <m><name></m>. Otherwise it matches.</desc> </commanddef> </commandlist> </section> <section> |