File: dom.html

package info (click to toggle)
tdom 0.9.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 7,260 kB
  • sloc: ansic: 56,762; xml: 20,797; tcl: 3,618; sh: 658; makefile: 83; cpp: 30
file content (750 lines) | stat: -rw-r--r-- 35,592 bytes parent folder | download
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
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
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
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
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
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
465
466
467
468
469
470
471
472
473
474
475
476
477
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
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
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
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
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
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
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
<html>
<head>
<link rel="stylesheet" href="manpage.css"><title>tDOM manual: dom</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="#SECTid0x5616e7c6e4b0">NAME</a> · <a href="#SECTid0x5616e7ca9630">SYNOPSIS</a> · <a href="#SECTid0x5616e7d4a850">DESCRIPTION </a> · <a href="#SECTid0x5616e7db2f90">KEYWORDS</a>
</div><hr class="navsep">
</div><div class="body">
  <h2><a name="SECTid0x5616e7c6e4b0">NAME</a></h2><p class="namesection">
<b class="names">dom - </b><br>Create an in-memory DOM tree from XML</p>
  
  <h2><a name="SECTid0x5616e7ca9630">SYNOPSIS</a></h2><pre class="syntax">package require tdom

<b class="cmd">dom</b> <i class="m">method</i> ?<i class="m">arg arg ...</i>?</pre>

  <h2><a name="SECTid0x5616e7d4a850">DESCRIPTION </a></h2><p>This command provides the creation of DOM trees in memory. In
the usual case a string containing a XML information is parsed and converted
into a DOM tree. Other possible parse input may be HTML or JSON.
The <i class="m">method</i> indicates a specific subcommand. </p><p>The valid methods are:</p><dl class="commandlist">
        
          <dt>
<b class="cmd">dom</b> <b class="method">parse</b> ?<i class="m">options</i>? ?<i class="m">data</i>?</dt>
          <dd>Parses the XML information and builds up the DOM tree in memory
providing a Tcl object command to this DOM document object. Example:

      <pre class="example">
dom parse $xml doc
$doc documentElement root</pre>

      <p>parses the XML in the variable xml, creates the DOM tree in memory,
make a reference to the document object, visible in Tcl as a document object
command, and assigns this new object name to the variable doc. When doc gets
freed, the DOM tree and the associated Tcl command object (document and all
node objects) are freed automatically.</p>
      
      <pre class="example">
set document [dom parse $xml]
set root     [$document documentElement]</pre>

      <p>parses the XML in the variable xml, creates the DOM tree in memory,
make a reference to the document object, visible in Tcl as a document object
command, and returns this new object name, which is then stored in
<i class="m">document</i>.  To free the underlying DOM tree and the associative Tcl
object commands (document + nodes + fragment nodes) the document object command
has to be explicitly deleted by:</p>

      <pre class="example">
$document delete
</pre>or<pre class="example">
rename $document ""</pre>

<p>The valid options are:</p>
<dl class="optlist">
              
                <dt><b>-simple</b></dt> 
                <dd>If <i class="m">-simple</i> is specified, a simple but
                fast parser is used (conforms not fully to XML
                recommendation). That should double parsing and DOM
                generation speed. The encoding of the data is not
                transformed inside the parser. The simple parser does
                not respect any encoding information in the XML
                declaration. It skips over the internal DTD subset and
                ignores any information in it. Therefore it doesn't
                include defaulted attribute values into the tree, even
                if the according attribute declaration is in the
                internal subset. It also doesn't expand internal or
                external entity references other than the predefined
                entities and character references </dd>
              

              
                <dt><b>-html</b></dt>
                <dd>If <i class="m">-html</i> is specified, a fast HTML parser
                is used, which tries to even parse badly formed HTML
                into a DOM tree. If the HTML document given to parse
                does not have a single root element (as it was legal
                up to HTML 4.01) and the -forest option is not used
                then a html node will be inserted as document element,
                with the HTML input data top level elements as
                childs.</dd>
              

              
                <dt><b>-html5</b></dt>
                <dd>This option is only available if tDOM was build
                with --enable-html5. Try the <i class="m">featureinfo</i> method
                if you need to know if this feature is build in. If
                <i class="m">-html5</i> is specified, the gumbo lib html5 parser
                (https://github.com/google/gumbo-parser) is used to
                build the DOM tree. This is, as far as it goes, XML
                namespace-aware. Since this probably isn't wanted by a
                lot of users and adds only burden for no good in a lot
                of use cases <i class="m">-html5</i> can be combined with
                <i class="m">-ignorexmlns</i>, in which case all nodes and
                attributes in the DOM tree are not in an XML
                namespace. All tag and attribute names in the DOM tree
                will be lower case, even for foreign elements not in
                the xhtml, svg or mathml namespace. The DOM tree may
                include nodes, that the parser inserted because they
                are implied by the context (as &lt;head&gt;,
                &lt;tbody&gt;, etc.).</dd>
              

              
                <dt><b>-json</b></dt>
                <dd>If <i class="m">-json</i> is specified, the <i class="m">data</i> is
                expected to be a valid JSON string (according to RFC
                7159). The command returns an ordinary DOM document
                with nesting token inside the JSON data translated
                into tree hierarchy. If a JSON array value is itself
                an object or array then container element nodes named
                (in a default build) arraycontainer or
                objectcontainer, respectively, are inserted into the
                tree. The JSON serialization of this document (with
                the domDoc method <i class="m">asJSON</i>) is the same JSON
                information as the <i class="m">data</i>, preserving JSON
                datatypes, allowing non-unique member names of objects
                while preserving their order and the full range of
                JSON string values. JSON datatype handling is done
                with an additional property "sticking" at the doc and
                tree nodes. This property isn't contained in an XML
                serialization of the document. If you need to store
                the JSON data represented by a document, store the
                JSON serialization and parse it back from there. Apart
                from this JSON type information the returned doc
                command or handle is an ordinary DOM doc, which may be
                investigated or modified with the full range of the
                doc and node methods. Please note that the element
                node names and the text node values within the tree
                may be outside of what the appropriate XML productions
                allow.</dd>
              

              
                <dt><b>-jsonroot &lt;document element name&gt;</b></dt>
                <dd>If given makes the given element name the
                document element of the resulting doc. The parsed
                content of the JSON string will be the children of
                this document element node.</dd>
              
              
              
                <dt>
<b>-jsonmaxnesting</b> <i>integer</i>
</dt>
                
                <dd>This option only has effect if used together
                with the <i class="m">-json</i> option. The current
                implementation uses a recursive descent JSON parser.
                In order to avoid using excess stack space, any JSON
                input that has more than a certain levels of nesting
                is considered invalid. The default maximum nesting is
                2000. The option -jsonmaxnesting allows the user to
                adjust that.</dd>
              
              
              
                <dt><b>--</b></dt> 
                <dd>The option <i class="m">--</i> marks the end of options.
                While respected in general this option is only needed
                in case of parsing JSON data, which may start with a
                "-".</dd>
              

              
                <dt><b>-keepEmpties</b></dt> 
                <dd>If <i class="m">-keepEmpties</i> is
specified then text nodes which contain only whitespaces will be part of the
resulting DOM tree. In default case (<i class="m">-keepEmpties</i> not given) those empty
text nodes are removed at parsing time.</dd>
              

              
                <dt><b>-keepCDATA</b></dt> 
                <dd>If <i class="m">-keepCDATA</i> is
specified then CDATA sections aren't added to the tree as text nodes
(and, if necessary, combined with sibling text nodes into one text
node) as without this option but are added as CDATA_SECTION_NODEs to
the tree. Please note that the resulting tree isn't prepared for XPath
selects or to be the source or the stylesheet of an XSLT
transformation. If not combined with <i class="m">-keepEmpties</i> only not
whitespace only CDATA sections will be added to the resulting DOM
                tree.</dd>
              
              
              
                <dt>
<b>-channel</b> <i>&lt;channel-ID&gt;</i>
</dt>
                
                <dd>If <i class="m">-channel &lt;channel-ID&gt;</i> is specified, the
input to be parsed is read from the specified channel. The encoding setting of
the channel (via fconfigure -encoding) is respected, ie the data read from the
channel are converted to UTF-8 according to the encoding settings before the
data is parsed.</dd>
              

              
                <dt>
<b>-baseurl</b> <i>&lt;baseURI&gt;</i>
</dt>
                
                <dd>If <i class="m">-baseurl &lt;baseURI&gt;</i> is specified,
                the baseURI is used as the base URI of the document.
                External entities references in the document are
                resolved relative to this base URI. This base URI is
                also stored within the DOM tree.</dd>
              

              
                <dt>
<b>-feedbackAfter</b> <i>&lt;#bytes&gt;</i>
</dt>
                
                <dd>If <i class="m">-feedbackAfter &lt;#bytes&gt;</i> is
                specified, the tcl command given by
                <i class="m">-feedbackcmd</i> is evaluated at the first element
                start within the document (or an external entity)
                after the start of the document or external entity or
                the last such call after #bytes. For backward
                compatibility if no -feedbackcmd is given but there is
                a tcl proc named ::dom::domParseFeedback this proc is
                used as -feedbackcmd. If there isn't such a proc and
                -feedbackAfter is used it is an error to not also use
                -feedbackcmd. If the called script raises error, then
                parsing will be aborted, the <i class="m">dom parse</i> call
                returns error, with the script error msg as error msg.
                If the called script <i class="m">return -code break</i>, the
                parsing will abort and the <i class="m">dom parse</i> call will
                return the empty string.</dd>
              

              
                <dt>
<b>-feedbackcmd</b> <i>&lt;script&gt;</i>
</dt>
                
                <dd>If <i class="m">-feedbackcmd &lt;script&gt;</i> is specified, the
script <i class="m">script</i> is evaluated at the first
element start within the document (or an external entity) after the
start of the document or external entity or the last such call after
#bytes value given by the <i class="m">-feedbackAfter</i> option. If
<i class="m">-feedbackAfter</i> isn't given, using this option
doesn't has any effect. If the called
script raises error, then parsing will be aborted, the
<i class="m">dom parse</i> call returns error, with the script
error msg as error msg. If the called script <i class="m">return
-code break</i>, the parsing will abort and the <i class="m">dom
parse</i> call will return the empty string.</dd>
              

              
                <dt>
<b>-externalentitycommand</b> <i>&lt;script&gt;</i>
</dt>
                
                <dd>If <i class="m">-externalentitycommand &lt;script&gt;</i> is
specified, the specified tcl script is called to resolve any external entities
of the document. The actual evaluated command consists of this option followed
by three arguments: the base uri, the system identifier of the entity and the
public identifier of the entity. The base uri and the public identifier may be
the empty list. The script has to return a tcl list consisting of three
elements. The first element of this list signals how the external entity is
returned to the processor. Currently the two allowed types are "string"
and "channel". The second element of the list has to be the (absolute) base URI
of the external entity to be parsed.  The third element of the list are data,
either the already read data out of the external entity as string in the case
of type "string", or the name of a tcl channel, in the case of type
"channel". Note that if the script returns a tcl channel, it will not be closed
by the processor.  It must be closed separately if it is no longer
needed.</dd>
              

              
                <dt>
<b>-useForeignDTD</b> <i>&lt;boolean&gt;</i>
</dt>
                 <dd>If
                &lt;boolean&gt; is true and the document does not have
                an external subset, the parser will call the
                -externalentitycommand script with empty values for
                the systemId and publicID arguments. Please note that
                if the document also doesn't have an internal subset,
                the -startdoctypedeclcommand and
                -enddoctypedeclcommand scripts, if set, are not
                called.</dd>
              

              
                <dt>
<b>-paramentityparsing</b> <i>&lt;always|never|notstandalone&gt;</i>
</dt>
                
                <dd>The <i class="m">-paramentityparsing</i> option controls,
                if the parser tries to resolve the external entities
                (including the external DTD subset) of the document
                while building the DOM tree.
                <i class="m">-paramentityparsing</i> requires an argument, which
                must be either "always", "never", or "notstandalone".
                The value "always" means that the parser tries to
                resolves (recursively) all external entities of the
                XML source. This is the default in case
                <i class="m">-paramentityparsing</i> is omitted. The value
                "never" means that only the given XML source is
                parsed and no external entity (including the external
                subset) will be resolved and parsed. The value
                "notstandalone" means, that all external entities will
                be resolved and parsed, with the exception of
                documents, which explicitly states standalone="yes" in
                their XML declaration.</dd>
              


              
                <dt><b>-forest</b></dt>
                <dd>If this option is given, there is no need for a
                single root; any sequence of well-formed, balanced
                subtrees will be parsed into a DOM tree. This works
                for the expat DOM builder, the simple xml parser
                enabled with <i class="m">-simple</i> and the simple HTML parser
                enabled -with <i class="m">-html</i>. If used together with
                <i class="m">-json</i> or <i class="m">-html5</i> this option is ignored.
                </dd>
              
              
              
                <dt><b>-ignorexmlns</b></dt>
                <dd>It is recommended, that you only use this option
                with the <i class="m">-html5</i> option. If this option is
                given, no node within the created DOM tree will be
                internally marked as placed into an XML Namespace,
                even if there is a default namespace in scope for
                un-prefixed elements or even if the element has a
                defined namespace prefix. One consequence is that
                XPath node expressions on such a DOM tree doesn't work
                as may be expected. Prefixed element nodes can't be
                selected naively and element nodes without prefix will
                be seen by XPath expressions as if they are not in any
                namespace (no matter if they are in fact should be in
                a default namespace). If you need to inject prefixed
                node names into an XPath expression use the '%' syntax
                described in the documentation of the of the
                <b class="command">domNode</b> command method
                <b class="method">&gt;selectNodes</b>.
                </dd>
              

              
                <dt>
<b>-billionLaughsAttackProtectionMaximumAmplification</b> <i>&lt;float&gt;</i>
</dt>
                
                <dd>This option together with
                <i class="m">-billionLaughsAttackProtectionActivationThreshold</i>
                gives control over the parser limits that protects
                against billion laugh attacks
                (<a href="https://en.wikipedia.org/wiki/Billion_laughs_attack">https://en.wikipedia.org/wiki/Billion_laughs_attack</a>).
                This option expects a float &gt;= 1.0 as argument. You
                should never need to use this option, because the
                default value (100.0) should work for any real data.
                If you ever need to increase this value for non-attack
                payload, please report.</dd>
              
              
              
                <dt>
<b>-billionLaughsAttackProtectionActivationThreshold</b> <i>&lt;long&gt;</i>
</dt>
                
                <dd>This option together with
                <i class="m">-billionLaughsAttackProtectionMaximumAmplification</i>
                gives control over the parser limits that protects
                against billion laugh attacks
                (<a href="https://en.wikipedia.org/wiki/Billion_laughs_attack">https://en.wikipedia.org/wiki/Billion_laughs_attack</a>).
                This option expects a positiv integer as argument. You
                should never need to use this option, because the
                default value (8388608) should work for any real data.
                If you ever need to increase this value for non-attack
                payload, please report.</dd>
              

          </dl>
<p></p>
</dd>
        

        
          <dt>
<b class="cmd">dom</b> <b class="method">createDocument</b>
<i class="m">docElemName</i> ?<i class="m">objVar</i>?</dt>
          <dd>Creates a new DOM document object with one element node with
node name <i class="m">docElemName</i>. The <i class="m">objVar</i> controls the
memory handling as explained above.</dd>
        

        
          <dt>
<b class="cmd">dom</b> <b class="method">createDocumentNS</b>
<i class="m">uri</i> <i class="m">docElemName</i> ?<i class="m">objVar</i>?</dt>
          <dd>Creates a new DOM document object with one element node with
node name <i class="m">docElemName</i>. <i class="m">Uri</i> gives the namespace of the
document element to create. The <i class="m">objVar</i> controls the
memory handling as explained above.</dd>
        

        
          <dt>
<b class="cmd">dom</b> <b class="method">createDocumentNode</b>
?<i class="m">objVar</i>?</dt>
          <dd>Creates a new 'empty' DOM document object without any element
node. <i class="m">objVar</i> controls the memory handling as explained above.</dd>
        

        
          <dt>
<b class="cmd">dom</b> <b class="method">createNodeCmd</b>
<i class="m">?-returnNodeCmd?</i> <i class="m">?-tagName name?</i> <i class="m">?-jsonType jsonType?</i> <i class="m">?-namespace URI?</i> <i class="m">(element|comment|text|cdata|pi)Node</i> <i class="m">commandName</i>
</dt>
          <dd>This method creates Tcl commands, which in turn create
          tDOM nodes. Tcl commands created by this command are only
          available inside a script given to the domNode methods
          <i class="m">appendFromScript</i> or <i class="m">insertBeforeFromScript</i>. If
          a command created with <i class="m">createNodeCmd</i> is invoked in
          any other context, it will return error. The created command
          <i class="m">commandName</i> replaces any existing command or
          procedure with that name. If the <i class="m">commandName</i> includes
          any Tcl namespace qualifiers, it is created in the specified
          namespace. The <i class="m">-tagName</i> option is only allowed for
          the elementNode type. The <i class="m">-jsonType</i> option is only
          allowed for elementNode and textNode types.

<p>If such command is invoked inside a script given as argument to the
domNode method <i class="m">appendFromScript</i> or
<i class="m">insertBeforeFromScript</i> it creates a new node and appends this
node at the end of the child list of the invoking element node. If the
option <i class="m">-returnNodeCmd</i> was given, the command returns the
created node as Tcl command. If this option was omitted, the command
returns nothing. Each command creates always the same type of node.
Which type of node is created by the command is determined by the
first argument to the <i class="m">createNodeCmd</i>. The syntax of the created
command depends on the type of the node it creates.</p>

<p>If the command type to create is <i class="m">elementNode</i>, the created
command will create an element node, if called. Without the
<i class="m">-tagName</i> option the tag name of the created node is
<i class="m">commandName</i> without Tcl namespace qualifiers. If the
<i class="m">-tagName</i> option was given then the created command the created
elements will have this tag name. If the <i class="m">-jsonType</i> option was
given then the created node elements will have the given JSON type. If
the <i class="m">-namespace</i> option is given the created element node will be
XML namespaced and in the namespace given by the option. The element
name will be literal as given either by the command name or the
<i class="m">-tagname</i> option, if that was given. An appropriate XML
namespace declaration will be automatically added, to bind the prefix
(if the element name has one) or the default namespace (if the element
name hasn't a prefix) to the namespace if such a binding isn't in
scope.</p>

<p>The syntax of the created command is:</p>

<pre class="syntax">
<b class="cmd">elementNodeCmd</b> <i class="m">?attributeName attributeValue ...? ?script?</i>
<b class="cmd">elementNodeCmd</b> <i class="m">?-attributeName attributeValue ...? ?script?</i>
<b class="cmd">elementNodeCmd</b> <i class="m">name_value_list script</i>
</pre>

<p>The command syntax allows three different ways to specify the attributes of
the resulting element. These could be specified with <i class="m">attributeName
attributeValue</i> argument pairs, in an "option style" way with
<i class="m">-attriubteName attributeValue</i> argument pairs (the '-' character is only
syntactical sugar and will be stripped off) or as a Tcl list with elements
interpreted as attribute name and the corresponding attribute value.
The attribute name elements in the list may have a leading '-' character, which
will be stripped off.</p>

<p>Every <i class="m">elementNodeCmd</i> accepts an optional Tcl script as last
argument. This script is evaluated as recursive <i class="m">appendFromScript</i> script
with the node created by the <i class="m">elementNodeCmd</i> as parent of all nodes
created by the script.</p>

<p>If the first argument of the method is <i class="m">textNode</i>, the command
will create a text node. If the <i class="m">-jsonType</i> option was given then
the created text node will have that JSON type. The syntax of the
created command is:</p>

<pre class="syntax">
<b class="cmd">textNodeCmd</b> ?-disableOutputEscaping? <i class="m">data</i>
</pre>

<p>If the optional flag <i class="m">-disableOutputEscaping</i> is given, the
escaping of the ampersand character (&amp;) and the left angle bracket (&lt;)
inside the data is disabled. You should use this flag carefully.</p>

<p>If the first argument of the method is <i class="m">commentNode</i> or 
<i class="m">cdataNode</i> the command will create an comment node or CDATA section 
node. The syntax of the created command is:</p>

<pre class="syntax">
<b class="cmd">nodeCmd</b> <i class="m">data</i>
</pre>

<p>If the first argument of the method is <i class="m">piNode</i>, the command will
create a processing instruction node. The syntax of the created
command is:</p>

<pre class="syntax">
<b class="cmd">piNodeCmd</b> <i class="m">target data</i>
</pre>

</dd>
        

        
          <dt>
<b class="cmd">dom</b> <b class="method">setStoreLineColumn</b> <i class="m">?boolean</i>?</dt>
          <dd>If switched on, the DOM nodes will contain line and column
position information for the original XML document after parsing. The default
is not to store line and column position information.</dd>
        

        
          <dt>
<b class="cmd">dom</b> <b class="method">setNameCheck</b> <i class="m">?boolean</i>?</dt>
          <dd>If NameCheck is true, every method which expects an XML Name,
a full qualified name or a processing instructing target will check, if the
given string is valid according to its production rule. For commands created
with the <i class="m">createNodeCmd</i> method to be used in the context of
<i class="m">appendFromScript</i> the status of the flag at creation time
decides. If NameCheck is true at creation time, the command will
check its arguments, otherwise not. The <i class="m">setNameCheck</i>
set this flag. It returns the current NameCheck flag state. The
default state for NameCheck is true. </dd>
        

        
          <dt>
<b class="cmd">dom</b> <b class="method">setTextCheck</b> <i class="m">?boolean</i>?</dt>
          <dd>If TextCheck is true, every command which expects XML Chars,
a comment, a CDATA section value or a processing instructing value will check,
if the given string is valid according to its production rule. For commands
created with the <i class="m">createNodeCmd</i> method to be used in the
context of <i class="m">appendFromScript</i> the status of the flag at
creation time decides. If TextCheck is true at creation time, the
command will check its arguments, otherwise not.The
<i class="m">setTextCheck</i> method sets this flag. It returns the current
TextCheck flag state. The default state for TextCheck is true.</dd>
      

        
          <dt>
<b class="cmd">dom</b> <b class="method">setObjectCommands</b> ?<i class="m">(automatic|token|command)</i>?</dt>
          <dd>Controls if documents and nodes are created as tcl commands or
as token to be
used with the domNode and domDoc commands. If the mode is
'automatic', then methods used at tcl commands will create tcl
commands and methods used at doc or node tokes will create tokens. If
the mode is 'command' then always tcl commands will be created. If
the mode is 'token', then always token will be created. The method
returns the current mode. This method is an experimental interface.</dd>
      

        
          <dt>
<b class="cmd">dom</b> <b class="method">isName</b> <i class="m">name</i>
</dt>
          <dd>Returns 1 if <i class="m">name</i> is a valid XML Name according to
production 5 of the <a href="http://www.w3.org/TR/2004/REC-xml-20040204/#NT-NameChar">XML
            1.0</a> recommendation. This means that <i class="m">name</i> is a valid
          XML element or attribute name. Otherwise it returns 0.</dd>
        

        
          <dt>
<b class="cmd">dom</b> <b class="method">isPIName</b> <i class="m">name</i>
</dt>
          <dd>Returns 1 if <i class="m">name</i> is a valid XML processing instruction
          target according to
production 17 of the <a href="http://www.w3.org/TR/2000/REC-xml-20001006.html">XML 1.0</a> recommendation. Otherwise it returns 0.</dd>
        

        
          <dt>
<b class="cmd">dom</b> <b class="method">isNCName</b> <i class="m">name</i>
</dt>
          <dd>Returns 1 if <i class="m">name</i> is a valid NCName according
to production 4 of the of the <a href="http://www.w3.org/TR/1999/REC-xml-names-19990114">Namespaces in XML</a> recommendation. Otherwise it returns
0.</dd>
        

        
          <dt>
<b class="cmd">dom</b> <b class="method">isQName</b> <i class="m">name</i>
</dt>
          <dd>Returns 1 if <i class="m">name</i> is a valid QName according
to production 6 of the of the <a href="http://www.w3.org/TR/1999/REC-xml-names-19990114">Namespaces in XML</a> recommendation. Otherwise it returns
0.</dd>
        

        
          <dt>
<b class="cmd">dom</b> <b class="method">isCharData</b>
<i class="m">string</i>
</dt>
          <dd>Returns 1 if every character in <i class="m">string</i> is
a valid XML Char according to production 2 of the <a href="http://www.w3.org/TR/2000/REC-xml-20001006.html">XML 1.0</a>
recommendation. Otherwise it returns 0.</dd>
        

        
          <dt>
<b class="cmd">dom</b> <b class="method">clearString</b> <i class="m">string</i>
</dt>
          <dd>Returns the string given as argument cleared out from any characters not
          allowed as XML parsed character data.</dd>
        
        
        
          <dt>
<b class="cmd">dom</b> <b class="method">isBMPCharData</b>
<i class="m">string</i>
</dt>
          <dd>Returns 1 if every character in <i class="m">string</i> is
a valid XML Char with a Unicode code point within the Basic
Multilingual Plane (that means, that every character within the string
is at most 3 bytes long). Otherwise it returns 0.</dd>
        

        
          <dt>
<b class="cmd">dom</b> <b class="method">isComment</b>
<i class="m">string</i>
</dt>
          <dd>Returns 1 if <i class="m">string</i> is
a valid comment according to production 15 of the <a href="http://www.w3.org/TR/2000/REC-xml-20001006.html">XML 1.0</a>
recommendation. Otherwise it returns 0.</dd>
        

        
          <dt>
<b class="cmd">dom</b> <b class="method">isCDATA</b>
<i class="m">string</i>
</dt>
          <dd>Returns 1 if <i class="m">string</i> is
valid according to production 20 of the <a href="http://www.w3.org/TR/2000/REC-xml-20001006.html">XML 1.0</a>
recommendation. Otherwise it returns 0.</dd>
        

        
          <dt>
<b class="cmd">dom</b> <b class="method">isPIValue</b>
<i class="m">string</i>
</dt>
          <dd>Returns 1 if <i class="m">string</i> is
valid according to production 16 of the <a href="http://www.w3.org/TR/2000/REC-xml-20001006.html">XML 1.0</a>
recommendation. Otherwise it returns 0.</dd>
        

        
            <dt>
<b class="cmd">dom</b> <b class="method">featureinfo</b> <i class="m">feature</i>
</dt>
            <dd>This method provides information about the used
            build options and the expat version. The valid values for
            the <i class="m">feature</i> argument are:
            <dl class="optlist">
                
                    <dt><b>expatversion</b></dt>
                    <dd>Returns the version of the underlyling expat
                    version as string, something like
                    "exapt_2.1.0". This is what the expat API
                    function XML_ExpatVersion() returns.</dd>
                
                
                    <dt><b>expatmajorversion</b></dt>
                    <dd>Returns the major version of the at build
                    time used expat version as integer.</dd>
                
                
                    <dt><b>expatminorversion</b></dt>
                    <dd>Returns the minor version of the at build
                    time used expat version as integer.</dd>
                
                
                    <dt><b>expatmicroversion</b></dt>
                    <dd>Returns the micro version of the at build
                    time used expat version as integer.</dd>
                
                
                    <dt><b>dtd</b></dt>
                    <dd>Returns as boolean if build with
                    <i class="m">--enable-dtd</i>.</dd>
                
                
                    <dt><b>ns</b></dt>
                    <dd>Returns as boolean if build with
                    <i class="m">--enable-ns</i>.</dd>
                
                
                    <dt><b>unknown</b></dt>
                    <dd>Returns as boolean if build with
                    <i class="m">--enable-unknown</i>.</dd>
                
                
                    <dt><b>tdomalloc</b></dt>
                    <dd>Returns as boolean if build with
                    <i class="m">--enable-tdomalloc</i>.</dd>
                
                
                    <dt><b>lessns</b></dt>
                    <dd>Returns as boolean if build with
                    <i class="m">--enable-lessns</i>.</dd>
                
                
                    <dt><b>TCL_UTF_MAX</b></dt>
                    <dd>Returns the TCL_UTF_MAX value of the tcl
                    core, tDOM was build with as integer</dd>
                
                
                    <dt><b>html5</b></dt>
                    <dd>Returns as boolean, if build with
                    <i class="m">--enable-html5</i>.</dd>
                
                
                    <dt><b>versionhash</b></dt>
                    <dd>Returns the fossil repository version hash.</dd>
                
                
                    <dt><b>pullparser</b></dt>
                    <dd>Returns as boolean if the pullparser command
                    is build in.</dd>
                
                
                    <dt><b>schema</b></dt>
                    <dd>Returns as boolean if the tDOM schema features
                    are build in.</dd>
                
            </dl>
            </dd>   
        
    </dl>

<h2><a name="SECTid0x5616e7db2f90">KEYWORDS</a></h2><p class="keywords">
<a class="keyword" href="keyword-index.html#KW-XML">XML</a>, <a class="keyword" href="keyword-index.html#KW-DOM">DOM</a>, <a class="keyword" href="keyword-index.html#KW-document">document</a>, <a class="keyword" href="keyword-index.html#KW-node">node</a>, <a class="keyword" href="keyword-index.html#KW-parsing">parsing</a>
</p>
</div><hr class="navsep"><div class="navbar" align="center">
<a class="navaid" href="index.html">Contents</a> · <a class="navaid" href="category-index.html">Index</a> · <a class="navaid" href="keyword-index.html">Keywords</a> · <a class="navaid" href="http://tdom.org">Repository</a>
</div>
</body>
</html>