@cntwg/xml-lib-js 0.0.21 → 0.0.23
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 +13 -0
- package/LICENSE +9 -9
- package/index.js +31 -31
- package/lib/xmldoc-lib.js +25 -17
- package/package.json +8 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
#### *v0.0.23*
|
|
2
|
+
|
|
3
|
+
Pre-release version.
|
|
4
|
+
|
|
5
|
+
> - updated dependency on `@ygracs/bsfoc-lib-js` module to v0.1.3;
|
|
6
|
+
> - updated dependency on `@ygracs/xobj-lib-js` module to v0.0.14rc4.
|
|
7
|
+
|
|
8
|
+
#### *v0.0.22*
|
|
9
|
+
|
|
10
|
+
Pre-release version.
|
|
11
|
+
|
|
12
|
+
> - some fixes in `xmldoc-lib.js` module.
|
|
13
|
+
|
|
1
14
|
#### *v0.0.21*
|
|
2
15
|
|
|
3
16
|
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.
|
|
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(
|
|
310
|
+
_setChildRaw(...args){
|
|
311
311
|
//console.log('CHECK: TXmlElementController._setChildRaw() => was called...');
|
|
312
|
-
|
|
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.
|
|
3
|
+
"version": "0.0.23",
|
|
4
4
|
"description": "A library for handling an XML-documents",
|
|
5
5
|
"author": "ygracs <cs70th-om@rambler.ru>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,12 +28,16 @@
|
|
|
28
28
|
"test-xml:cdec": "jest TXmlContentDeclaration",
|
|
29
29
|
"test-xml:cc": "jest TXmlContentContainer"
|
|
30
30
|
},
|
|
31
|
+
"imports": {
|
|
32
|
+
"#lib/*": "./lib/*"
|
|
33
|
+
},
|
|
31
34
|
"dependencies": {
|
|
32
|
-
"@ygracs/bsfoc-lib-js": "^0.1.
|
|
35
|
+
"@ygracs/bsfoc-lib-js": "^0.1.3",
|
|
33
36
|
"@ygracs/xml-js6": "^0.0.3-b",
|
|
34
|
-
"@ygracs/xobj-lib-js": "^0.0.14-
|
|
37
|
+
"@ygracs/xobj-lib-js": "^0.0.14-rc4"
|
|
35
38
|
},
|
|
36
39
|
"devDependencies": {
|
|
37
|
-
"jest": "^29.
|
|
40
|
+
"jest": "^29.6.1",
|
|
41
|
+
"minimist": "^1.2.8"
|
|
38
42
|
}
|
|
39
43
|
}
|