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

Overview
Comment:Work on the info method and the documentation for that method.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | schema
Files: files | file ages | folders
SHA3-256: e3fd3c93a902a6cf571f7fc682aa2a6aaebc36d8c8872f93fa8c6cefa0526b22
User & Date: rolf 2019-11-15 13:45:46
Context
2019-11-15
15:17
Updated documentation example section. check-in: c0721894cc user: rolf tags: schema
13:45
Work on the info method and the documentation for that method. check-in: e3fd3c93a9 user: rolf tags: schema
10:22
Moved schema command method nrForwardDefinitions as subcommand to info; it belongs more there. check-in: 05086c2182 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
..
76
77
78
79
80
81
82
83



84
85
86
87
88
89
90
...
230
231
232
233
234
235
236













































































237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
...
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
...
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
...
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
...
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
<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="#SECTid0x560e9533c640">NAME</a> · <a href="#SECTid0x560e9528d120">SYNOPSIS</a> · <a href="#SECTid0x560e9531a800">DESCRIPTION </a> · <a href="#SECTid0x560e95375c20">Schema definition scripts</a> · <a href="#SECTid0x560e95380850">Quantity specifier</a> · <a href="#SECTid0x560e953826a0">Text constraint scripts</a> · <a href="#SECTid0x560e9538c4b0">Local key constraints</a> · <a href="#SECTid0x560e9538e2c0">Exampels</a>
</div><hr class="navsep">
</div><div class="body">
  <h2><a name="SECTid0x560e9533c640">NAME</a></h2><p class="namesection">
<b class="names">tdom::schema - </b><br>Create a schema validation command</p>

  <h2><a name="SECTid0x560e9528d120">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="SECTid0x560e9531a800">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 data or to post-validate a tDOM DOM tree (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">
................................................................................

      
        <dt>
<b class="method">deftext</b> <i class="m">name</i> <i class="m">&lt;constraint script&gt;</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">start</b> <i class="m">documentElement</i> <i class="m">?namespace?</i>
</dt>
        <dd>This method defines the name and namespace of the root
................................................................................
                  post-validating a DOM tree ist command returns the
                  current parent node command (the node, whose content
                  is currently validated) and the empty string
                  otherwhise. It is recommended that you don't use
                  this method. Or at least leaf the DOM tree alone,
                  use it read-only.</dd>
              













































































          </dl>
          </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="SECTid0x560e95375c20">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 qualify the content as valid. It is a
    validation error if there is additional (not matched) content.</p><p>The schema definition commands are:</p><dl class="commandlist">
      
................................................................................
        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="SECTid0x560e95380850">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.</dd>
................................................................................
        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 &gt;= 0 and n &lt; 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="SECTid0x560e953826a0">Text constraint scripts</a></h2><p>Text - parsed character data, as XML calles it - must sometimes
    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><b class="cmd">base64</b></dt>
        <dd>This text constraint match if text is valid according to
        RFC 4648.</dd>
      
    </dl>

  <h2><a name="SECTid0x560e9538c4b0">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">&lt;names list&gt;</i> <i class="m">&lt;constraint script&gt;</i>
</dt>
................................................................................
            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">&lt;name&gt;</i>. Otherwise it
            matches.</dd>
        
    </dl>

  <h2><a name="SECTid0x560e9538e2c0">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">
&lt;xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;

  &lt;xsd:annotation&gt;
    &lt;xsd:documentation xml:lang="en"&gt;
     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
..
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
...
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
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
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
...
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
...
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
...
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
...
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
<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="#SECTid0x55da2a6a4640">NAME</a> · <a href="#SECTid0x55da2a5f5120">SYNOPSIS</a> · <a href="#SECTid0x55da2a682800">DESCRIPTION </a> · <a href="#SECTid0x55da2a6e0ad0">Schema definition scripts</a> · <a href="#SECTid0x55da2a6eb700">Quantity specifier</a> · <a href="#SECTid0x55da2a6ed550">Text constraint scripts</a> · <a href="#SECTid0x55da2a6f7360">Local key constraints</a> · <a href="#SECTid0x55da2a6f9170">Exampels</a>
</div><hr class="navsep">
</div><div class="body">
  <h2><a name="SECTid0x55da2a6a4640">NAME</a></h2><p class="namesection">
<b class="names">tdom::schema - </b><br>Create a schema validation command</p>

  <h2><a name="SECTid0x55da2a5f5120">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="SECTid0x55da2a682800">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 data or to post-validate a tDOM DOM tree (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">
................................................................................

      
        <dt>
<b class="method">deftext</b> <i class="m">name</i> <i class="m">&lt;constraint script&gt;</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. If there is already a text
        type definition with this name, the command raises error. A
        text type must be defined before it can be used in schema
        definition scripts.</dd>
      
      
      
        <dt>
<b class="method">start</b> <i class="m">documentElement</i> <i class="m">?namespace?</i>
</dt>
        <dd>This method defines the name and namespace of the root
................................................................................
                  post-validating a DOM tree ist command returns the
                  current parent node command (the node, whose content
                  is currently validated) and the empty string
                  otherwhise. It is recommended that you don't use
                  this method. Or at least leaf the DOM tree alone,
                  use it read-only.</dd>
              
              
                  <dt><b>nrForwardDefinitions</b></dt>
                  <dd>Returns the at least used once referenced
                  element and ref particles that aren't defined so far
                  (summed together).</dd>
              
              
                  <dt><b>definedElements</b></dt>
                  <dd>Returns in no particular order the defined
                  elements in the grammer as list. If an element is
                  namespaced its list entry will be itself a list with
                  two elements, with the name as first and the
                  namespace as second element.</dd>
              
              
                  <dt><b>expected</b></dt> <dd>Returns in no
                  particular order all posible next events (since the
                  last successful event match, if there was one) as a
                  list. If an element is namespaced its list entry
                  will be itself a list with two elements, with the
                  name as first and the namespace as second element.
                  If text is a possible next event the list entry will
                  be a two elements list, with #text as first element
                  and the empty space as second. If an any element
                  constraint is possible the list entry will be a two
                  elements list, with &lt;any&gt; as first element and
                  the empty space as second. If an any element in a
                  certain namespace constraint is possible the list
                  entry will be a two elements list, with &lt;any&gt; as
                  first element and the namespace as second. If
                  element end is a possible event the list entry will
                  be a two elements list with &lt;elementend&gt; and the
                  empty string as second element.</dd>
              
              
                  <dt><b>definition name ?namespace?</b></dt>
                  <dd>Returns the code that defines the given
                  element. The command raises error if there isn' a
                  definition of that element.
                  </dd>
              
              
                  <dt><b>vaction ?name|namespace|text?</b></dt>
                  <dd>If the schema command is currently processing
                  a validation event this method returns information
                  about what the command is doing. If the command is
                  called without the optional argument the possible
                  return values and their meanings are:
                  <dl>
                      <dt>NONE</dt><dd></dd>
                      <dt>MATCH_ELEMENT_START</dt><dd></dd>
                      <dt>MATCH_ELEMENT_END</dt><dd></dd>
                      <dt>MATCH_TEXT</dt><dd></dd>
                      <dt>MATCH_ATTRIBUTE_TEXT</dt><dd></dd>
                      <dt>MATCH_GLOBAL</dt><dd></dd>
                      <dt>MATCH_DOM_KEYCONSTRAINT</dt><dd></dd>
                  </dl>
                  If called with one of the possible optional
                  arguments the command returns detail information
                  depending on current action.
                  <dl>
                      <dt>name</dt><dd>Return the name of the element
                      that has to match in case of
                      MATCH_ELEMENT_START. Return the name of the
                      closed element in case of MATCH_ELEMENT_END.
                      Return the name of the parent element in case of
                      MATCH_TEXT.</dd>
                      <dt>namespace</dt><dd>Return the namespace of
                      the element that has to match in case of
                      MATCH_ELEMENT_START. Return the namespace of the
                      closed element in case of MATCH_ELEMENT_END.
                      Return the namespace of the parent element in
                      case of MATCH_TEXT.</dd>
                      <dt>text</dt><dd></dd>
                  </dl>
                  </dd>
              
          </dl>
          </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="SECTid0x55da2a6e0ad0">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 qualify the content as valid. It is a
    validation error if there is additional (not matched) content.</p><p>The schema definition commands are:</p><dl class="commandlist">
      
................................................................................
        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="SECTid0x55da2a6eb700">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.</dd>
................................................................................
        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 &gt;= 0 and n &lt; 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="SECTid0x55da2a6ed550">Text constraint scripts</a></h2><p>Text - parsed character data, as XML calles it - must sometimes
    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><b class="cmd">base64</b></dt>
        <dd>This text constraint match if text is valid according to
        RFC 4648.</dd>
      
    </dl>

  <h2><a name="SECTid0x55da2a6f7360">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">&lt;names list&gt;</i> <i class="m">&lt;constraint script&gt;</i>
</dt>
................................................................................
            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">&lt;name&gt;</i>. Otherwise it
            matches.</dd>
        
    </dl>

  <h2><a name="SECTid0x55da2a6f9170">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">
&lt;xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;

  &lt;xsd:annotation&gt;
    &lt;xsd:documentation xml:lang="en"&gt;
     Purchase order schema for Example.com.

Changes to doc/schema.n.

221
222
223
224
225
226
227
228



229
230
231
232
233
234
235
...
327
328
329
330
331
332
333












































































334
335
336
337
338
339
340
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\fBstart\fP \fIdocumentElement\fB \fI?namespace?\fB
\&\fRThis 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 \fIstart\fR isn't
used, any with \fIdefelement\fR defined element may be the
root of a valid document. The \fIstart\fR method may be used
................................................................................
If the schema command is currently
post-validating a DOM tree ist command returns the
current parent node command (the node, whose content
is currently validated) and the empty string
otherwhise. It is recommended that you don't use
this method. Or at least leaf the DOM tree alone,
use it read-only.












































































.RE
.TP
\&\fB\fBreset\fP
\&\fRThis method resets the validation command into state
READY (while preserving the defined grammer).
.SH "Schema definition scripts"
.PP







|
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
...
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
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
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
414
415
416
417
418
419
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. If there is already a text
type definition with this name, the command raises error. A
text type must be defined before it can be used in schema
definition scripts.
.TP
\&\fB\fBstart\fP \fIdocumentElement\fB \fI?namespace?\fB
\&\fRThis 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 \fIstart\fR isn't
used, any with \fIdefelement\fR defined element may be the
root of a valid document. The \fIstart\fR method may be used
................................................................................
If the schema command is currently
post-validating a DOM tree ist command returns the
current parent node command (the node, whose content
is currently validated) and the empty string
otherwhise. It is recommended that you don't use
this method. Or at least leaf the DOM tree alone,
use it read-only.
.IP "\fBnrForwardDefinitions\fR"
Returns the at least used once referenced
element and ref particles that aren't defined so far
(summed together).
.IP "\fBdefinedElements\fR"
Returns in no particular order the defined
elements in the grammer as list. If an element is
namespaced its list entry will be itself a list with
two elements, with the name as first and the
namespace as second element.
.IP "\fBexpected\fR"
Returns in no
particular order all posible next events (since the
last successful event match, if there was one) as a
list. If an element is namespaced its list entry
will be itself a list with two elements, with the
name as first and the namespace as second element.
If text is a possible next event the list entry will
be a two elements list, with #text as first element
and the empty space as second. If an any element
constraint is possible the list entry will be a two
elements list, with <any> as first element and
the empty space as second. If an any element in a
certain namespace constraint is possible the list
entry will be a two elements list, with <any> as
first element and the namespace as second. If
element end is a possible event the list entry will
be a two elements list with <elementend> and the
empty string as second element.
.IP "\fBdefinition name ?namespace?\fR"
Returns the code that defines the given
element. The command raises error if there isn' a
definition of that element.
.IP "\fBvaction ?name|namespace|text?\fR"
If the schema command is currently processing
a validation event this method returns information
about what the command is doing. If the command is
called without the optional argument the possible
return values and their meanings are:
.RS
.TP
NONE
.TP
MATCH_ELEMENT_START
.TP
MATCH_ELEMENT_END
.TP
MATCH_TEXT
.TP
MATCH_ATTRIBUTE_TEXT
.TP
MATCH_GLOBAL
.TP
MATCH_DOM_KEYCONSTRAINT
If called with one of the possible optional
arguments the command returns detail information
depending on current action.
.TP
name
Return the name of the element
that has to match in case of
MATCH_ELEMENT_START. Return the name of the
closed element in case of MATCH_ELEMENT_END.
Return the name of the parent element in case of
MATCH_TEXT.
.TP
namespace
Return the namespace of
the element that has to match in case of
MATCH_ELEMENT_START. Return the namespace of the
closed element in case of MATCH_ELEMENT_END.
Return the namespace of the parent element in
case of MATCH_TEXT.
.TP
text
.RE
.RE
.TP
\&\fB\fBreset\fP
\&\fRThis method resets the validation command into state
READY (while preserving the defined grammer).
.SH "Schema definition scripts"
.PP

Changes to doc/schema.xml.

73
74
75
76
77
78
79
80



81
82
83
84
85
86
87
...
211
212
213
214
215
216
217













































































218
219
220
221
222
223
224
        command raises error.</desc>
      </commanddef>

      <commanddef>
        <command><method>deftext</method> <m>name</m> <m>&lt;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
................................................................................
                  post-validating a DOM tree ist command returns the
                  current parent node command (the node, whose content
                  is currently validated) and the empty string
                  otherwhise. It is recommended that you don't use
                  this method. Or at least leaf the DOM tree alone,
                  use it read-only.</desc>
              </optdef>













































































          </optlist>
          </desc>
      </commanddef>
      
      <commanddef>
        <command><method>reset</method></command>
        <desc>This method resets the validation command into state







|
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
...
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
        command raises error.</desc>
      </commanddef>

      <commanddef>
        <command><method>deftext</method> <m>name</m> <m>&lt;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. If there is already a text
        type definition with this name, the command raises error. A
        text type must be defined before it can be used in schema
        definition scripts.</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
................................................................................
                  post-validating a DOM tree ist command returns the
                  current parent node command (the node, whose content
                  is currently validated) and the empty string
                  otherwhise. It is recommended that you don't use
                  this method. Or at least leaf the DOM tree alone,
                  use it read-only.</desc>
              </optdef>
              <optdef>
                  <optname>nrForwardDefinitions</optname>
                  <desc>Returns the at least used once referenced
                  element and ref particles that aren't defined so far
                  (summed together).</desc>
              </optdef>
              <optdef>
                  <optname>definedElements</optname>
                  <desc>Returns in no particular order the defined
                  elements in the grammer as list. If an element is
                  namespaced its list entry will be itself a list with
                  two elements, with the name as first and the
                  namespace as second element.</desc>
              </optdef>
              <optdef>
                  <optname>expected</optname> <desc>Returns in no
                  particular order all posible next events (since the
                  last successful event match, if there was one) as a
                  list. If an element is namespaced its list entry
                  will be itself a list with two elements, with the
                  name as first and the namespace as second element.
                  If text is a possible next event the list entry will
                  be a two elements list, with #text as first element
                  and the empty space as second. If an any element
                  constraint is possible the list entry will be a two
                  elements list, with &lt;any> as first element and
                  the empty space as second. If an any element in a
                  certain namespace constraint is possible the list
                  entry will be a two elements list, with &lt;any> as
                  first element and the namespace as second. If
                  element end is a possible event the list entry will
                  be a two elements list with &lt;elementend> and the
                  empty string as second element.</desc>
              </optdef>
              <optdef>
                  <optname>definition name ?namespace?</optname>
                  <desc>Returns the code that defines the given
                  element. The command raises error if there isn' a
                  definition of that element.
                  </desc>
              </optdef>
              <optdef>
                  <optname>vaction ?name|namespace|text?</optname>
                  <desc>If the schema command is currently processing
                  a validation event this method returns information
                  about what the command is doing. If the command is
                  called without the optional argument the possible
                  return values and their meanings are:
                  <dl>
                      <dt>NONE</dt><dd></dd>
                      <dt>MATCH_ELEMENT_START</dt><dd></dd>
                      <dt>MATCH_ELEMENT_END</dt><dd></dd>
                      <dt>MATCH_TEXT</dt><dd></dd>
                      <dt>MATCH_ATTRIBUTE_TEXT</dt><dd></dd>
                      <dt>MATCH_GLOBAL</dt><dd></dd>
                      <dt>MATCH_DOM_KEYCONSTRAINT</dt><dd></dd>
                  </dl>
                  If called with one of the possible optional
                  arguments the command returns detail information
                  depending on current action.
                  <dl>
                      <dt>name</dt><dd>Return the name of the element
                      that has to match in case of
                      MATCH_ELEMENT_START. Return the name of the
                      closed element in case of MATCH_ELEMENT_END.
                      Return the name of the parent element in case of
                      MATCH_TEXT.</dd>
                      <dt>namespace</dt><dd>Return the namespace of
                      the element that has to match in case of
                      MATCH_ELEMENT_START. Return the namespace of the
                      closed element in case of MATCH_ELEMENT_END.
                      Return the namespace of the parent element in
                      case of MATCH_TEXT.</dd>
                      <dt>text</dt><dd></dd>
                  </dl>
                  </desc>
              </optdef>
          </optlist>
          </desc>
      </commanddef>
      
      <commanddef>
        <command><method>reset</method></command>
        <desc>This method resets the validation command into state

Changes to generic/schema.c.

1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
....
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560


3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579





3580
3581
3582
3583
3584
3585
3586
            sdata->vname = se->pattern->name;
            sdata->vns = se->pattern->namespace;
        }
        sdata->vaction = MATCH_TEXT;
        break;
    case UNKOWN_GLOBAL_ID:
    case UNKOWN_ID:
        sdata->vaction = MATCH_TEXT;
        break;
    case INVALID_ATTRIBUTE_VALUE:
        sdata->vaction = MATCH_ATTRIBUTE_TEXT;
        break;
    }
    sdata->currentEvals++;
    rc = Tcl_EvalObjEx (interp, cmdPtr,
................................................................................
    case m_definition:
        if (objc < 3 && objc > 4) {
            Tcl_WrongNumArgs (interp, 1, objv, "name ?namespace?");
            return TCL_ERROR;
        }
        h = Tcl_FindHashEntry (&sdata->element, Tcl_GetString (objv[2]));
        if (!h) {
            SetResult ("Unknown element");
            return TCL_ERROR;
        }
        cp = Tcl_GetHashValue (h);
        ns = NULL;
        if (objc == 4) {
            ns = getNamespacePtr (sdata, Tcl_GetString (objv[3]));
        }
        while (cp && cp->namespace != ns) {
            cp = cp->next;
        }
        if (!cp) {


            SetResult ("Unknown element");
            return TCL_ERROR;
        }
        if (cp->flags & LOCAL_DEFINED_ELEMENT) {
            Tcl_AppendElement (interp, "element");
        } else {
            Tcl_AppendElement (interp, "defelement");
        }
        Tcl_AppendElement (interp, cp->name);
        if (cp->namespace) {
            Tcl_AppendElement (interp, cp->namespace);
        }
        if (cp->defScript) {
            Tcl_AppendElement (interp, Tcl_GetString (cp->defScript));
        }
        break;

    case m_vaction:
    case m_validationaction:





        if (objc == 2) {
            SetResult (ValidationAction2str[sdata->vaction]);
            break;
        }
        if (objc != 3) {
            Tcl_WrongNumArgs (interp, 2, objv, "?name|namespace|text?");
            return TCL_ERROR;







|







 







|










|
>
>
|


<
<
<
|
<











>
>
>
>
>







1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
....
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565



3566

3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
            sdata->vname = se->pattern->name;
            sdata->vns = se->pattern->namespace;
        }
        sdata->vaction = MATCH_TEXT;
        break;
    case UNKOWN_GLOBAL_ID:
    case UNKOWN_ID:
        sdata->vaction = MATCH_GLOBAL;
        break;
    case INVALID_ATTRIBUTE_VALUE:
        sdata->vaction = MATCH_ATTRIBUTE_TEXT;
        break;
    }
    sdata->currentEvals++;
    rc = Tcl_EvalObjEx (interp, cmdPtr,
................................................................................
    case m_definition:
        if (objc < 3 && objc > 4) {
            Tcl_WrongNumArgs (interp, 1, objv, "name ?namespace?");
            return TCL_ERROR;
        }
        h = Tcl_FindHashEntry (&sdata->element, Tcl_GetString (objv[2]));
        if (!h) {
            SetResult ("Unknown element definition");
            return TCL_ERROR;
        }
        cp = Tcl_GetHashValue (h);
        ns = NULL;
        if (objc == 4) {
            ns = getNamespacePtr (sdata, Tcl_GetString (objv[3]));
        }
        while (cp && cp->namespace != ns) {
            cp = cp->next;
        }
        if (!cp
            || cp->flags & LOCAL_DEFINED_ELEMENT
            || cp->flags & PLACEHOLDER_PATTERN_DEF) {
            SetResult ("Unknown element definition");
            return TCL_ERROR;
        }



        Tcl_AppendElement (interp, "defelement");

        Tcl_AppendElement (interp, cp->name);
        if (cp->namespace) {
            Tcl_AppendElement (interp, cp->namespace);
        }
        if (cp->defScript) {
            Tcl_AppendElement (interp, Tcl_GetString (cp->defScript));
        }
        break;

    case m_vaction:
    case m_validationaction:
        if (sdata->validationState != VALIDATION_STARTED
            || sdata->currentEvals == 0) {
            SetResult ("NONE");
            break;
        }
        if (objc == 2) {
            SetResult (ValidationAction2str[sdata->vaction]);
            break;
        }
        if (objc != 3) {
            Tcl_WrongNumArgs (interp, 2, objv, "?name|namespace|text?");
            return TCL_ERROR;