@cntwg/xml-lib-js 0.0.21 → 0.0.22

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/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ #### *v0.0.22*
2
+
3
+ Pre-release version.
4
+
5
+ > - some fixes in `xmldoc-lib.js` module.
6
+
1
7
  #### *v0.0.21*
2
8
 
3
9
  Pre-release version.
package/LICENSE CHANGED
@@ -1,9 +1,9 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2019-2023 Yuri Grachev
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
-
7
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
-
9
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019-2023 Yuri Grachev
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/index.js CHANGED
@@ -1,31 +1,31 @@
1
- // [v0.1.009-20230316]
2
-
3
- // === module init block ===
4
-
5
- const xObj = require('@ygracs/xobj-lib-js');
6
- const xmldoc = require('./lib/xmldoc-lib.js');
7
-
8
- // === module extra block (helper functions) ===
9
-
10
- // === module main block ===
11
-
12
- // === module exports block ===
13
-
14
- exports.xObj = xObj;
15
-
16
- // will deprecate
17
- exports.DEF_XML_PARSE_OPTIONS = xmldoc.XML_DEF_PARSE_OPTIONS;
18
- // will deprecate
19
- exports.DEF_XML_ROOT_ETAG_NAME = xmldoc.XML_DEF_ROOT_ETAG_NAME;
20
-
21
- exports.XML_DEF_PARSE_OPTIONS = xmldoc.XML_DEF_PARSE_OPTIONS;
22
- exports.XML_DEF_ROOT_ETAG_NAME = xmldoc.XML_DEF_ROOT_ETAG_NAME;
23
-
24
- exports.TXmlContentParseOptions = xmldoc.TXmlContentParseOptions;
25
-
26
- exports.TXmlAttributesMapper = xmldoc.TXmlAttributesMapper;
27
- exports.TXmlElementController = xmldoc.TXmlElementController;
28
- exports.TXmlElementsListController = xmldoc.TXmlElementsListController;
29
- exports.TXmlContentDeclaration = xmldoc.TXmlContentDeclaration;
30
- exports.TXmlContentRootElement = xmldoc.TXmlContentRootElement;
31
- exports.TXmlContentContainer = xmldoc.TXmlContentContainer;
1
+ // [v0.1.009-20230316]
2
+
3
+ // === module init block ===
4
+
5
+ const xObj = require('@ygracs/xobj-lib-js');
6
+ const xmldoc = require('./lib/xmldoc-lib.js');
7
+
8
+ // === module extra block (helper functions) ===
9
+
10
+ // === module main block ===
11
+
12
+ // === module exports block ===
13
+
14
+ exports.xObj = xObj;
15
+
16
+ // will deprecate
17
+ exports.DEF_XML_PARSE_OPTIONS = xmldoc.XML_DEF_PARSE_OPTIONS;
18
+ // will deprecate
19
+ exports.DEF_XML_ROOT_ETAG_NAME = xmldoc.XML_DEF_ROOT_ETAG_NAME;
20
+
21
+ exports.XML_DEF_PARSE_OPTIONS = xmldoc.XML_DEF_PARSE_OPTIONS;
22
+ exports.XML_DEF_ROOT_ETAG_NAME = xmldoc.XML_DEF_ROOT_ETAG_NAME;
23
+
24
+ exports.TXmlContentParseOptions = xmldoc.TXmlContentParseOptions;
25
+
26
+ exports.TXmlAttributesMapper = xmldoc.TXmlAttributesMapper;
27
+ exports.TXmlElementController = xmldoc.TXmlElementController;
28
+ exports.TXmlElementsListController = xmldoc.TXmlElementsListController;
29
+ exports.TXmlContentDeclaration = xmldoc.TXmlContentDeclaration;
30
+ exports.TXmlContentRootElement = xmldoc.TXmlContentRootElement;
31
+ exports.TXmlContentContainer = xmldoc.TXmlContentContainer;
package/lib/xmldoc-lib.js CHANGED
@@ -1,4 +1,4 @@
1
- // [v0.1.065-20230316]
1
+ // [v0.1.066-20230317]
2
2
 
3
3
  // === module init block ===
4
4
 
@@ -307,23 +307,9 @@ class TXmlElementController {
307
307
  return item !== undefined ? item : null;
308
308
  }
309
309
 
310
- _setChildRaw(name, obj){
310
+ _setChildRaw(...args){
311
311
  //console.log('CHECK: TXmlElementController._setChildRaw() => was called...');
312
- let isSUCCEED = false; let item = null;
313
- if (isArray(obj)) {
314
- //console.log('CHECK: TXmlElementController._setChildRaw() => <obj> is array...');
315
- item = xObj.insertXObjEList(this.#_host, name, true);
316
- // load elements
317
- for (let element of obj) {
318
- if (isPlainObject(element)) item.push(element);
319
- };
320
- } else if (isObject(obj)) {
321
- //console.log('CHECK: TXmlElementController._setChildRaw() => <obj> is object...');
322
- item = xObj.insertXObjElement(this.#_host, name, { force: true });
323
- // // TODO: set element
324
- };
325
- if (item) isSUCCEED = true;
326
- return isSUCCEED;
312
+ return TXmlElementController.__setChildRaw(this, ...args);
327
313
  }
328
314
 
329
315
  _addChildRaw(name){//}, obj){
@@ -390,6 +376,28 @@ class TXmlElementController {
390
376
  return (item instanceof TXmlElementController) ? item.#_host : null;
391
377
  }
392
378
 
379
+ static __setChildRaw(node, name, obj){
380
+ //console.log('CHECK: TXmlElementController.__setChildRaw() => was called...');
381
+ let isSUCCEED = false;
382
+ if (node instanceof TXmlElementController) {
383
+ let item = null;
384
+ if (isArray(obj)) {
385
+ //console.log('CHECK: TXmlElementController.__setChildRaw() => <obj> is array...');
386
+ item = xObj.insertXObjEList(node.#_host, name, { force: true });
387
+ // load elements
388
+ for (let element of obj) {
389
+ if (isPlainObject(element)) item.push(element);
390
+ };
391
+ } else if (isObject(obj)) {
392
+ //console.log('CHECK: TXmlElementController.__setChildRaw() => <obj> is object...');
393
+ item = xObj.insertXObjElement(node.#_host, name, { force: true });
394
+ // // TODO: set element
395
+ };
396
+ if (item) isSUCCEED = true;
397
+ };
398
+ return isSUCCEED;
399
+ }
400
+
393
401
  static clear(obj){
394
402
  let item = TXmlElementController.__unwrap(obj);
395
403
  if (item) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntwg/xml-lib-js",
3
- "version": "0.0.21",
3
+ "version": "0.0.22",
4
4
  "description": "A library for handling an XML-documents",
5
5
  "author": "ygracs <cs70th-om@rambler.ru>",
6
6
  "license": "MIT",