@cntwg/xml-lib-js 0.0.30 → 0.0.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/doc/xmldoc-lib.md CHANGED
@@ -1,11 +1,29 @@
1
- >|***rev.*:**|0.1.30|
1
+ >|***rev.*:**|0.1.37|
2
2
  >|:---|---:|
3
- >|date:|2024-09-23|
3
+ >|date:|2025-02-06|
4
4
 
5
5
  ## Introduction
6
6
 
7
7
  This paper describes a constants, functions and an object classes provided by `xmldoc-lib.js` module.
8
8
 
9
+ ### Base type definitions
10
+
11
+ This section contains some definitions for a general types of the objects (e.g. options set) that frequently used in a function or a class method descriptions.
12
+
13
+ <a name="typedef+fsoDescr"></a>
14
+ #### `fsoDescr` - descriptor
15
+
16
+ This descriptor is an `object` that describes a status for an operation with some FS-object (*e.g. object such as a file*).
17
+
18
+ | property name | value type | optional | description |
19
+ |:---|---|---:|:---|
20
+ | `isERR` | `boolean` | no | a flag which indicates whether an error was happen |
21
+ | `errCode` | `number` | yes | an error code |
22
+ | `errEvent` | `string` | no | an error event identifier |
23
+ | `errMsg` | `string` | no | an error message |
24
+ | `source` | `string` | no | path to a file |
25
+ | `content` | `any` | no | content |
26
+
9
27
  ## Module constants
10
28
 
11
29
  ### **XML\_DEF\_PARSE_OPTIONS**
@@ -51,24 +69,39 @@ This constant defines a default value for naming the language attribute for XML-
51
69
 
52
70
  > Note: Purpose of those functions will be discussed and some may be deprecate and make obsolete or functionality may be altered. So use it with cautions in mind.
53
71
 
72
+ <a name="readAsTagName"></a>
54
73
  #### **readAsTagName(value)** => `string`
55
74
 
56
- > since: `v0.0.28`
75
+ > since: \[`v0.0.28`]
57
76
 
58
77
  This function tries to convert a given `value` to the value of type which is suitable for an XML-element's tag name. If failed an empty string is returned.
59
78
 
79
+ | parameter name | value type | default value | description |
80
+ |:---|---|---:|:---|
81
+ | `value` | `any` | --- | some value to read |
82
+
83
+ <a name="readAsAttrName"></a>
60
84
  #### **readAsAttrName(value)** => `string`
61
85
 
62
- > since: `v0.0.28`
86
+ > since: \[`v0.0.28`]
63
87
 
64
88
  This function tries to convert a given `value` to the value of type which is suitable for an XML-element's attribute name. If failed an empty string is returned.
65
89
 
90
+ | parameter name | value type | default value | description |
91
+ |:---|---|---:|:---|
92
+ | `value` | `any` | --- | some value to read |
93
+
94
+ <a name="valueToElementID"></a>
66
95
  #### **valueToElementID(value)**
67
96
 
68
- > since: `v0.0.28`
97
+ > since: \[`v0.0.28`]
69
98
 
70
99
  This function tries to convert a given `value` to the value of a valid identifier which is suitable for an XML-element's ID-attribute. If failed an empty string is returned.
71
100
 
101
+ | parameter name | value type | default value | description |
102
+ |:---|---|---:|:---|
103
+ | `value` | `any` | --- | some value to read |
104
+
72
105
  ## Module classes
73
106
 
74
107
  ### **TXmlContentParseOptions**
@@ -100,6 +133,7 @@ The table below describes a properties of a `TXmlContentParseOptions` class:
100
133
 
101
134
  This method transforms a given object to a set of accepted parser options.
102
135
 
136
+ <a name="TXmlAttributesMapper"></a>
103
137
  ### **TXmlAttributesMapper**
104
138
 
105
139
  This class implements a proxy interface for handling attributes of an element.
@@ -112,18 +146,18 @@ The class constructor creates a new instance of the class.
112
146
 
113
147
  The class constructor receives an arguments listed below:
114
148
 
115
- |parameter name|value type|default value|description|
149
+ | parameter name | value type | default value | description |
116
150
  |:---|---|---:|:---|
117
- |`object`|---|---|a host object that holds an attributes|
118
- |`options`|`object`|---|an options settings|
151
+ | `object` | `object` | --- | a host object that holds an attributes |
152
+ | `options` | `object` | --- | an options settings |
119
153
 
120
154
  ###### `options` parameter
121
155
 
122
156
  The `options` structure is listed below:
123
157
 
124
- |option name|value type|default value|description|
158
+ | option name | value type | default value | description |
125
159
  |:---|---|---:|:---|
126
- |`parseOptions`|`object`|`EMPTY_OBJECT`|contains a XML-parse options (*see description for `XML_DEF_PARSE_OPTIONS`*)|
160
+ | `parseOptions` | `object` | `EMPTY_OBJECT` | contains a XML-parse options (*see description for `XML_DEF_PARSE_OPTIONS`*) |
127
161
 
128
162
  ##### exceptions
129
163
 
@@ -131,39 +165,71 @@ If `object` parameter is not a type of `object` or not given a `TypeError` throw
131
165
 
132
166
  #### class properties
133
167
 
134
- |property name|value type|read only|description|
135
- |:---|---|---|:---|
136
- |`entries`|`array`|yes|returns an array of entries for all existing attributes|
168
+ <a name="TXmlAttributesMapper+entries"></a>
169
+ ##### **entries**
170
+
171
+ | property type | read only | description |
172
+ |---|---|:---|
173
+ | `array` | yes | contains a list of entries for all existing attributes |
137
174
 
138
175
 
139
176
  #### class methods
140
177
 
178
+ <a name="TXmlAttributesMapper+hasAttribute"></a>
141
179
  ##### **hasAttribute(name)** => `boolean`
142
180
 
143
181
  This method checks whether or not an attribute addressed by a `name` exists. If attribute exists, 'true' is returned.
144
182
 
183
+ | parameter name | value type | default value | description |
184
+ |:---|---|---:|:---|
185
+ | `name` | `string` | --- | some attribute name |
186
+
187
+ <a name="TXmlAttributesMapper+getAttribute"></a>
145
188
  ##### **getAttribute(name)** => `string`
146
189
 
147
190
  This method returns an attribute value addressed by a `name`. If attribute is not exists the empty string is returned.
148
191
 
192
+ | parameter name | value type | default value | description |
193
+ |:---|---|---:|:---|
194
+ | `name` | `string` | --- | some attribute name |
195
+
196
+ <a name="TXmlAttributesMapper+setAttribute"></a>
149
197
  ##### **setAttribute(name, value)** => `boolean`
150
198
 
151
199
  This method sets an attribute value addressed by a `name` and return `true` if succeed.
152
200
 
201
+ | parameter name | value type | default value | description |
202
+ |:---|---|---:|:---|
203
+ | `name` | `string` | --- | some attribute name |
204
+ | `value` | `any` | --- | some value |
205
+
206
+ <a name="TXmlAttributesMapper+delAttribute"></a>
153
207
  ##### **delAttribute(name)** => `boolean`
154
208
 
155
209
  This method clears an attribute value addressed by a `name`.
156
210
 
211
+ | parameter name | value type | default value | description |
212
+ |:---|---|---:|:---|
213
+ | `name` | `string` | --- | some attribute name |
214
+
215
+ <a name="TXmlAttributesMapper+renameAttribute"></a>
157
216
  ##### **renameAttribute(name, value)** => `boolean`
158
217
 
159
- > since: `v0.0.30`
218
+ > since: \[`v0.0.30`]
160
219
 
161
220
  This method renames an attribute addressed by a `name` to its new name given by a `value` parameter.
162
221
 
222
+ | parameter name | value type | default value | description |
223
+ |:---|---|---:|:---|
224
+ | `name` | `string` | --- | some attribute name |
225
+ | `value` | `string` | --- | new name of the attribute |
226
+
227
+ <a name="TXmlAttributesMapper+clear"></a>
163
228
  ##### **clear()** => `void`
164
229
 
165
230
  This method clears all attributes.
166
231
 
232
+ <a name="TXmlElementController"></a>
167
233
  ### **TXmlElementController**
168
234
 
169
235
  This class implements a proxy interface for an element.
@@ -176,19 +242,19 @@ The class constructor creates a new instance of the class.
176
242
 
177
243
  The class constructor receives an arguments listed below:
178
244
 
179
- |parameter name|value type|default value|description|
245
+ | parameter name | value type | default value | description |
180
246
  |:---|---|---:|:---|
181
- |`object`|`object`|---|a host object|
182
- |`options`|`object`|---|an options settings|
247
+ | `object` | `object` | --- | a host object |
248
+ | `options` | `object` | --- | an options settings |
183
249
 
184
250
  ###### `options` parameter
185
251
 
186
252
  The `options` structure is listed below:
187
253
 
188
- |option name|value type|default value|description|
254
+ | option name | value type | default value | description |
189
255
  |:---|---|---:|:---|
190
- |`proxyModeEnable`|`boolean`|`false`|<*reserved*>|
191
- |`parseOptions`|`object`|`EMPTY_OBJECT`|contains a XML-parse options (see description for `XML_DEF_PARSE_OPTIONS`)|
256
+ | `proxyModeEnable` | `boolean` | `false` | <*reserved*> |
257
+ | `parseOptions` | `object` | `EMPTY_OBJECT` | contains a XML-parse options (see description for `XML_DEF_PARSE_OPTIONS`) |
192
258
 
193
259
  ##### exceptions
194
260
 
@@ -196,40 +262,83 @@ If `object` parameter is not a type of `object` or not given a `TypeError` throw
196
262
 
197
263
  #### class properties
198
264
 
265
+ <a name="TXmlElementController+attributes"></a>
266
+ ##### **attributes**
267
+
268
+ | property type | read only | description |
269
+ |---|---|:---|
270
+ | `TXmlAttributesMapper` | yes | returns an attributes of the element |
271
+
272
+ <a name="TXmlElementController+textValue"></a>
273
+ ##### **textValue**
274
+
275
+ | property type | read only | description |
276
+ |---|---|:---|
277
+ | `string` | no | represents a value of the element |
278
+
279
+ #### class properties (*others*)
280
+
199
281
  |property name|value type|read only|description|
200
282
  |:---|---|---|:---|
201
- |`attributes`|`TXmlAttributesMapper`|yes|returns an attributes of the element|
202
283
  |`name`||yes|\<*reserved*>|
203
- |`textValue`|`string`|no|represents a value of the element|
204
284
 
205
285
  #### class methods
206
286
 
287
+ <a name="TXmlElementController+hasAttribute"></a>
207
288
  ##### **hasAttribute(name)** => `boolean`
208
289
 
209
290
  This method checks whether or not an attribute addressed by a `name` exists. If attribute exists, 'true' is returned.
210
291
 
292
+ | parameter name | value type | default value | description |
293
+ |:---|---|---:|:---|
294
+ | `name` | `string` | --- | some attribute name |
295
+
296
+ <a name="TXmlElementController+getAttribute"></a>
211
297
  ##### **getAttribute(name)** => `string`
212
298
 
213
299
  This method returns an attribute value addressed by a `name`. If attribute is not exists the empty string is returned.
214
300
 
301
+ | parameter name | value type | default value | description |
302
+ |:---|---|---:|:---|
303
+ | `name` | `string` | --- | some attribute name |
304
+
305
+ <a name="TXmlElementController+setAttribute"></a>
215
306
  ##### **setAttribute(name, value)** => `boolean`
216
307
 
217
308
  This method sets an attribute value addressed by a `name` and return `true` if succeed.
218
309
 
310
+ | parameter name | value type | default value | description |
311
+ |:---|---|---:|:---|
312
+ | `name` | `string` | --- | some attribute name |
313
+ | `value` | `any` | --- | some value |
314
+
315
+ <a name="TXmlElementController+delAttribute"></a>
219
316
  ##### **delAttribute(name)** => `boolean`
220
317
 
221
318
  This method clears an attribute value addressed by a `name` parameter.
222
319
 
320
+ | parameter name | value type | default value | description |
321
+ |:---|---|---:|:---|
322
+ | `name` | `string` | --- | some attribute name |
323
+
324
+ <a name="TXmlElementController+renameAttribute"></a>
223
325
  ##### **renameAttribute(name, value)** => `boolean`
224
326
 
225
- > since: `v0.0.30`
327
+ > since: \[`v0.0.30`]
226
328
 
227
329
  This method renames an attribute addressed by a `name` to its new name given by a `value` parameter.
228
330
 
331
+ | parameter name | value type | default value | description |
332
+ |:---|---|---:|:---|
333
+ | `name` | `string` | --- | some attribute name |
334
+ | `value` | `string` | --- | new name of the attribute |
335
+
336
+ <a name="TXmlElementController+getTextValue"></a>
229
337
  ##### **getTextValue()** => `array`
230
338
 
231
339
  This method returns an array witch contain a value of a `textValue` property and a value of a `lang` attribute in format: `[ <lang>, <textValue> ]`. If element has no `lang` attribute, it replaced by an empty string in the result.
232
340
 
341
+ <a name="TXmlElementController+setTextValue"></a>
233
342
  ##### **setTextValue(value)** => `boolean`
234
343
 
235
344
  This method sets the value of a `textValue` property and its `lang` attribute and if succeed returns `true`.
@@ -240,24 +349,45 @@ The method received value that can be a string or an array. If value is an array
240
349
  or
241
350
  `[ <lang>, <textValue> ]`.
242
351
 
352
+ <a name="TXmlElementController+hasChild"></a>
243
353
  ##### **hasChild(name)** => `boolean`
244
354
 
245
355
  This method checks whether or not a child element addressed by `name` is exists.
246
356
 
247
- ##### **getChild(name)** => `?(TXmlElementController|TXmlElementsListController)`
357
+ | parameter name | value type | default value | description |
358
+ |:---|---|---:|:---|
359
+ | `name` | `string` | --- | some child element name |
360
+
361
+ <a name="TXmlElementController+getChild"></a>
362
+ ##### **getChild(name)** => `null`\|`TXmlElementController`\|`TXmlElementsListController`
248
363
 
249
364
  This method returns a child element addressed by `name`. If failed `null` is returned.
250
365
 
366
+ | parameter name | value type | default value | description |
367
+ |:---|---|---:|:---|
368
+ | `name` | `string` | --- | some child element name |
369
+
370
+ <a name="TXmlElementController+addChild"></a>
251
371
  ##### **addChild(name)** => `?TXmlElementController`
252
372
 
253
373
  This method adds a new element as a child element addressed by a `name` parameter.
254
374
 
375
+ | parameter name | value type | default value | description |
376
+ |:---|---|---:|:---|
377
+ | `name` | `string` | --- | some child element name |
378
+
379
+ <a name="TXmlElementController+delChild"></a>
255
380
  ##### **delChild(name)** => `boolean`
256
381
 
257
382
  This method deletes a child element addressed by a `name`.
258
383
 
259
384
  > Warning: A method not fully implemented yet. Not use it for list like elements. If list contains a more than one element, a method will fail.
260
385
 
386
+ | parameter name | value type | default value | description |
387
+ |:---|---|---:|:---|
388
+ | `name` | `string` | --- | some child element name |
389
+
390
+ <a name="TXmlElementController+clear"></a>
261
391
  ##### **clear()** => `void`
262
392
 
263
393
  This method clears an element content.
@@ -266,38 +396,68 @@ This method clears an element content.
266
396
 
267
397
  > Note: Purpose of those methods will be discussed and some may be deprecate and make obsolete or functionality may be altered. So use it with cautions in mind.
268
398
 
399
+ <a name="TXmlElementController+loadFromXMLString"></a>
269
400
  ##### **loadFromXMLString(str)** => `boolean`
270
401
 
271
402
  This method loads an element content from a string given by a `str` parameter.
272
403
 
404
+ | parameter name | value type | default value | description |
405
+ |:---|---|---:|:---|
406
+ | `str` | `string` | --- | some content |
407
+
273
408
  ###### *exceptions*
274
409
 
275
- This methods trows `Error` if something goes wrong through a parsing process of a string.
410
+ This methods throws `Error` if something goes wrong through a parsing process of a string.
276
411
 
277
412
  #### class methods (*special*)
278
413
 
279
- ##### **_getChildRaw(name)**
414
+ ##### **_getChildRaw(name)** => `?any`
280
415
 
281
- This method returns a child element addressed by `name` as object.
416
+ > WARNING: **\[since `v0.0.31`]** this method deprecated (*use static `__getChildRaw` method of the class*).
282
417
 
283
- ##### **_addChildRaw(name)**
418
+ ##### **_addChildRaw(name)** => `?object`
284
419
 
285
- This method adds an element as a child element addressed by `name`.
420
+ > WARNING: **\[since `v0.0.31`]** this method deprecated (*use static `__addChildRaw` method of the class*).
286
421
 
287
- ##### **_setChildRaw(name, obj)**
422
+ ##### **_setChildRaw(name, obj)** => `boolean`
288
423
 
289
- This method inserts a given object as a child element addressed by `name`.
424
+ > WARNING: **\[since `v0.0.31`]** this method deprecated (*use static `__setChildRaw` method of the class*).
290
425
 
291
426
  #### class methods (*static*)
292
427
 
293
- ##### **__unwrap(item)**
428
+ ##### **clear(item)** => `void`
429
+
430
+ This method clears an `item` content.
431
+
432
+ ##### **create(obj, opt)** => `?(TXmlElementController|TXmlElementsListController)`
433
+
434
+ > since: \[`v0.0.30`]
435
+
436
+ This method creates an instance from a given object.
437
+
438
+ #### class methods (*static, special*)
439
+
440
+ ##### **__unwrap(node)** => `?object`
294
441
 
295
442
  This method returns a host for an element as an object. If failed `null` is returned.
296
443
 
297
- ##### **clear(item)** => `void`
444
+ ##### **__getChildRaw(node, name)** => `?any`
298
445
 
299
- This method clears an `item` content.
446
+ > since: \[`v0.0.31`]
447
+
448
+ This method returns a child element addressed by `name` as object. If failed `null` is returned.
449
+
450
+ ##### **__addChildRaw(node, name)** => `?object`
451
+
452
+ > since: \[`v0.0.31`]
453
+
454
+ This method adds an element addressed by `name` as a child element.
455
+
456
+ ##### **__setChildRaw(node, name, obj)** => `boolean`
457
+
458
+ This method inserts a given object as a child element addressed by `name`.
300
459
 
460
+ <a name="TXmlElementsListController"></a>
301
461
  ### **TXmlElementsListController**
302
462
 
303
463
  This class implements a proxy interface for a list of elements.
@@ -310,20 +470,20 @@ The class constructor creates a new instance of the class.
310
470
 
311
471
  The class constructor receives an arguments listed below:
312
472
 
313
- |parameter name|value type|default value|description|
473
+ | parameter name | value type | default value | description |
314
474
  |:---|---|---:|:---|
315
- |`object`|`array`|---|a host object of an array type.|
316
- |`options`|`object`|---|an options settings.|
475
+ | `object` | `object[]` | --- | a host object of an array type |
476
+ | `options` | `object` | --- | an options settings |
317
477
 
318
478
  ###### `options` parameter
319
479
 
320
480
  The `options` structure is listed below:
321
481
 
322
- |option name|value type|default value|description|
482
+ | option name | value type | default value | description |
323
483
  |:---|---|---:|:---|
324
- |`proxyModeEnable`|`boolean`|`false`|<*reserved*>|
325
- |`isNullItemsAllowed`|`boolean`|`false`|<*reserved*>|
326
- |`parseOptions`|`object`|`EMPTY_OBJECT`|contains a XML-parse options (see description for `XML_DEF_PARSE_OPTIONS`)|
484
+ | `proxyModeEnable` | `boolean` | `false` | <*reserved*> |
485
+ | `isNullItemsAllowed` | `boolean` | `false` | <*reserved*> |
486
+ | `parseOptions` | `object` | `EMPTY_OBJECT` | contains a XML-parse options (see description for `XML_DEF_PARSE_OPTIONS`) |
327
487
 
328
488
  ##### exceptions
329
489
 
@@ -331,64 +491,131 @@ If `object` parameter is not a type of `array` or not given a `TypeError` may be
331
491
 
332
492
  #### class properties
333
493
 
334
- |property name|property type|read only|description|
335
- |:---|---|---|:---|
336
- |`count`|`number`|yes|returns a quantity of the elements|
337
- |`size`|`number`|yes|returns a quantity of the elements|
338
- |`maxIndex`|`index`|yes|returns a last possible index of the elements|
339
- |`isNullItemsAllowed`|`boolean`|yes|indicates whether a list may be filled with the null-elements or not|
494
+ <a name="TXmlElementsListController+count"></a>
495
+ ##### **count**
496
+
497
+ | property type | read only | description |
498
+ |---|---|:---|
499
+ | `number` | yes | returns a quantity of the elements |
500
+
501
+ <a name="TXmlElementsListController+size"></a>
502
+ ##### **size**
503
+
504
+ | property type | read only | description |
505
+ |---|---|:---|
506
+ | `number` | yes | returns a quantity of the elements |
507
+
508
+ <a name="TXmlElementsListController+maxIndex"></a>
509
+ ##### **maxIndex**
510
+
511
+ | property type | read only | description |
512
+ |---|---|:---|
513
+ | `number` | yes | returns a last possible index of the element |
514
+
515
+ <a name="TXmlElementsListController+isNullItemsAllowed"></a>
516
+ ##### **isNullItemsAllowed**
517
+
518
+ | property type | read only | description |
519
+ |---|---|:---|
520
+ | `boolean` | yes | indicates whether a list may be filled with the `null`-elements or not |
340
521
 
341
522
  #### class methods
342
523
 
524
+ <a name="TXmlElementsListController+clear"></a>
343
525
  ##### **clear()** => `void`
344
526
 
345
527
  This method clears a list.
346
528
 
529
+ <a name="TXmlElementsListController+isEmpty"></a>
347
530
  ##### **isEmpty()** => `boolean`
348
531
 
349
532
  This method returns `true` if a list has no elements and `false` otherwise.
350
533
 
534
+ <a name="TXmlElementsListController+isNotEmpty"></a>
351
535
  ##### **isNotEmpty()** => `boolean`
352
536
 
353
537
  This method returns `true` if a list contains at least one element and `false` otherwise.
354
538
 
355
- ##### **chkIndex(index)** => `boolean`
539
+ <a name="TXmlElementsListController+chkIndex"></a>
540
+ ##### **chkIndex(value)** => `boolean`
356
541
 
357
542
  This method checks if a given index fits a range of elements within the list. If so `true` is returned.
358
543
 
544
+ | parameter name | value type | default value | description |
545
+ |:---|---|---:|:---|
546
+ | `value` | `number`, `string` | --- | some index value |
547
+
548
+ <a name="TXmlElementsListController+isValidItem"></a>
359
549
  ##### **isValidItem(obj)** => `boolean`
360
550
 
361
551
  This method checks whether or not a given element is valid.
362
552
 
553
+ | parameter name | value type | default value | description |
554
+ |:---|---|---:|:---|
555
+ | `obj` | `any` | --- | some element to verify |
556
+
557
+ <a name="TXmlElementsListController+getItem"></a>
363
558
  ##### **getItem(index)** => `?TXmlElementController`
364
559
 
365
560
  This method returns an element addressed by `index`. If failed `null` is returned.
366
561
 
367
- ##### **addItem(obj)** => `index`
562
+ | parameter name | value type | default value | description |
563
+ |:---|---|---:|:---|
564
+ | `index` | `number`, `string` | --- | element index |
565
+
566
+ <a name="TXmlElementsListController+addItem"></a>
567
+ ##### **addItem(obj)** => `number`
368
568
 
369
569
  This method adds an element to a list members. If succeed an index of the element is returned.
370
570
 
571
+ | parameter name | value type | default value | description |
572
+ |:---|---|---:|:---|
573
+ | `obj` | `any` | --- | some element |
574
+
575
+ <a name="TXmlElementsListController+_setItemRaw"></a>
371
576
  ##### **setItem(index, obj)** => `boolean`
372
577
 
373
578
  This method replaces an element addressed by `index` with a new element. If succeed `true` is returned.
374
579
 
580
+ | parameter name | value type | default value | description |
581
+ |:---|---|---:|:---|
582
+ | `index` | `number`, `string` | --- | element index |
583
+ | `obj` | `any` | --- | some element |
584
+
585
+ <a name="TXmlElementsListController+insItem"></a>
375
586
  ##### **insItem(index, obj)** => `boolean`
376
587
 
377
588
  This method inserts an element in the position addressed by `index`. If succeed `true` is returned.
378
589
 
590
+ | parameter name | value type | default value | description |
591
+ |:---|---|---:|:---|
592
+ | `index` | `number`, `string` | --- | element index |
593
+ | `obj` | `any` | --- | some element |
594
+
595
+ <a name="TXmlElementsListController+delItem"></a>
379
596
  ##### **delItem(index)** => `boolean`
380
597
 
381
598
  This method deletes an element addressed by `index`. If succeed `true` is returned.
382
599
 
600
+ | parameter name | value type | default value | description |
601
+ |:---|---|---:|:---|
602
+ | `index` | `number`, `string` | --- | element index |
603
+
604
+ <a name="TXmlElementsListController+loadItems"></a>
383
605
  ##### **loadItems(items, options)** => `number`
384
606
 
385
607
  This method loaded a list of elements listed by `items` and returns a quantity of a successfully added elements.
386
608
 
609
+ | parameter name | value type | default value | description |
610
+ |:---|---|---:|:---|
611
+ | `items` | `object`, `object[]` | --- | element or a list of an elements |
612
+ | `options` | `object` | --- | options |
613
+
387
614
  The `options` structure is listed below:
388
615
 
389
- |option name|value type|default value|description|
616
+ | option name | value type | default value | description |
390
617
  |:---|---|---:|:---|
391
- |`useClear`|`boolean`|`true`|if `true` the method deletes all the previous content before load the list|
618
+ | `useClear` | `boolean` | `true` | if `true` the method deletes all the previous content before load the list |
392
619
 
393
620
  #### class methods (*special*)
394
621
 
@@ -408,6 +635,7 @@ This method replaces an element addressed by `index` with a new element which is
408
635
 
409
636
  This method inserts an element as a raw object in the position addressed by `index`. If succeed `true` is returned.
410
637
 
638
+ <a name="TXmlContentDeclaration"></a>
411
639
  ### **TXmlContentDeclaration**
412
640
 
413
641
  This class implements a proxy interface for a document declaration element.
@@ -420,18 +648,18 @@ The class constructor creates a new instance of the class.
420
648
 
421
649
  The class constructor receives an arguments listed below:
422
650
 
423
- |parameter name|value type|default value|description|
651
+ | parameter name | value type | default value | description |
424
652
  |:---|---|---:|:---|
425
- |`object`|`object`|---|a host object for the document content.|
426
- |`options`|`object`|---|an options settings.|
653
+ | `object` | `object` | --- | a host object for the document content |
654
+ | `options` | `object` | --- | an options settings |
427
655
 
428
656
  ###### `options` parameter
429
657
 
430
658
  The `options` structure is listed below:
431
659
 
432
- |option name|value type|default value|description|
660
+ | option name | value type | default value | description |
433
661
  |:---|---|---:|:---|
434
- |`parseOptions`|`object`|`EMPTY_OBJECT`|contains a XML-parse options (see description for `XML_DEF_PARSE_OPTIONS`)|
662
+ | `parseOptions` | `object` | `EMPTY_OBJECT` | contains a XML-parse options (see description for `XML_DEF_PARSE_OPTIONS`) |
435
663
 
436
664
  ##### exceptions
437
665
 
@@ -439,10 +667,19 @@ If `object` parameter is not a type of `object` or not given a `TypeError` throw
439
667
 
440
668
  #### class properties
441
669
 
442
- |property name|property type|read only|description|
443
- |:---|---|---|:---|
444
- |`version`|`string`|no|returns a version of a XML|
445
- |`encoding`|`string`|no|returns an encodings used by a document|
670
+ <a name="TXmlContentDeclaration+version"></a>
671
+ ##### **version**
672
+
673
+ | property type | read only | description |
674
+ |---|---|:---|
675
+ | `string` | no | returns a version of an XML |
676
+
677
+ <a name="TXmlContentDeclaration+encoding"></a>
678
+ ##### **encoding**
679
+
680
+ | property type | read only | description |
681
+ |---|---|:---|
682
+ | `string` | no | returns a name of the character set used by the document |
446
683
 
447
684
  #### class methods (*special*)
448
685
 
@@ -495,6 +732,7 @@ The `options` parameter, if given, change a behavior for the method. If set to '
495
732
 
496
733
  #### class methods (*special*)
497
734
 
735
+ <a name="TXmlContentContainer"></a>
498
736
  ### **TXmlContentContainer**
499
737
 
500
738
  This class implements a proxy interface for manipulate a content of a document.
@@ -511,52 +749,82 @@ The class constructor receives an `options` parameter as its argument.
511
749
 
512
750
  The `options` structure is listed below:
513
751
 
514
- |option name|value type|default value|description|
752
+ | option name | value type | default value | description |
515
753
  |:---|---|---:|:---|
516
- |`rootETagName`|`string`|`root`|contains a the name of a tag that represents a root element|
517
- |`autoBindRoot`|`boolean`|`true`|<*reserved*>|
518
- |`proxyModeEnable`|`boolean`|`false`|<*reserved*>|
519
- |`isNullItemsAllowed`|`boolean`|`false`|<*reserved*>|
520
- |`parseOptions`|`object`|`EMPTY_OBJECT`|contains a XML-parse options (see description for `XML_DEF_PARSE_OPTIONS`)|
754
+ | `rootETagName` | `string` | `root` | contains a the name of a tag that represents a root element |
755
+ | `autoBindRoot` | `boolean` | `true` | <*reserved*> |
756
+ | `proxyModeEnable` | `boolean` | `false` | <*reserved*> |
757
+ | `isNullItemsAllowed` | `boolean` | `false` | <*reserved*> |
758
+ | `parseOptions` | `object` | `EMPTY_OBJECT` | contains a XML-parse options (see description for `XML_DEF_PARSE_OPTIONS`) |
521
759
 
522
760
  #### class properties
523
761
 
524
- |property name|value type|read only|description|
525
- |:---|---|---|:---|
526
- |rootElement||yes|returns a document root element|
762
+ <a name="TXmlContentContainer+rootElement"></a>
763
+ ##### **rootElement**
764
+
765
+ | property type | read only | description |
766
+ |---|---|:---|
767
+ | `TXmlContentRootElement` | yes | returns a document root element |
527
768
 
528
769
  #### class methods
529
770
 
771
+ <a name="TXmlContentContainer+clear"></a>
530
772
  ##### **clear()** => `void`
531
773
 
532
774
  This method clears a document content.
533
775
 
776
+ <a name="TXmlContentContainer+saveToXMLString"></a>
534
777
  ##### **saveToXMLString()** => `string`
535
778
 
536
779
  This method returns a document content as a string.
537
780
 
538
- ##### **saveToFileSync(src)**
781
+ <a name="TXmlContentContainer+saveToFileSync"></a>
782
+ ##### **saveToFileSync(src)** => `fsoDescr`
539
783
 
540
784
  This method saves a document content into a file addressed by `src`.
541
785
 
786
+ | parameter name | value type | default value | description |
787
+ |:---|---|---:|:---|
788
+ | `src` | `string` | --- | path to a file |
789
+
790
+ <a name="TXmlContentContainer+loadFromXMLString"></a>
542
791
  ##### **loadFromXMLString(str)** => `boolean`
543
792
 
544
793
  This method loads a document content from a string given by `str`.
545
794
 
546
- ##### **loadFromFileSync(src)**
795
+ | parameter name | value type | default value | description |
796
+ |:---|---|---:|:---|
797
+ | `str` | `string` | --- | some content |
798
+
799
+ <a name="TXmlContentContainer+loadFromFileSync"></a>
800
+ ##### **loadFromFileSync(src)** => `fsoDescr`
547
801
 
548
802
  This method loads a document content from a file addressed by `src`.
549
803
 
804
+ | parameter name | value type | default value | description |
805
+ |:---|---|---:|:---|
806
+ | `src` | `string` | --- | path to a file |
807
+
550
808
  #### class methods (*async*)
551
809
 
552
- ##### **saveToFile(src)**
810
+ <a name="TXmlContentContainer+saveToFile"></a>
811
+ ##### **saveToFile(src)** => `Promise<fsoDescr, Error>`
553
812
 
554
813
  This method saves a document content into a file addressed by `src`.
555
814
 
556
- ##### **loadFromFile(src)**
815
+ | parameter name | value type | default value | description |
816
+ |:---|---|---:|:---|
817
+ | `src` | `string` | --- | path to a file |
818
+
819
+ <a name="TXmlContentContainer+loadFromFile"></a>
820
+ ##### **loadFromFile(src)** => `Promise<fsoDescr, Error>`
557
821
 
558
822
  This method loads a document content from a file addressed by `src`.
559
823
 
824
+ | parameter name | value type | default value | description |
825
+ |:---|---|---:|:---|
826
+ | `src` | `string` | --- | path to a file |
827
+
560
828
  #### class methods (*special*)
561
829
 
562
830
  ##### **asJSON()**