diff --git a/compileruntime/convertxml_lib_standard/src/main/js/test/convertxml.test.js b/compileruntime/convertxml_lib_standard/src/main/js/test/convertxml.test.js
index f413b6d8a6bb3aa813a3771355cb3ac70eba4eb1..80d29571d9899f3d3f0768022ede5d7a58df97fd 100644
--- a/compileruntime/convertxml_lib_standard/src/main/js/test/convertxml.test.js
+++ b/compileruntime/convertxml_lib_standard/src/main/js/test/convertxml.test.js
@@ -13,7 +13,7 @@
* limitations under the License.
*/
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
-import ConvertXML from '@ohos.convertxml'
+import convertxml from '@ohos.convertxml'
describe('XmlTest', function () {
/**
@@ -30,8 +30,13 @@ describe('XmlTest', function () {
' Work' +
' Play' +
'';
- let convertml = new ConvertXML();
- let result1 = convertml.convert(xml, {compact: false, spaces: 0})
+ let conv = new convertxml.ConvertXML();
+ let options = {trim : false, declarationKey:"_declaration",
+ instructionKey : "_instruction", attributesKey : "_attributes",
+ textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
+ commentKey : "_comment", parentKey : "_parent", typeKey : "_type",
+ nameKey : "_name", elementsKey : "_elements"}
+ let result = JSON.stringify(conv.convert(xml, options));
let str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"_type":"element",'+
@@ -50,7 +55,7 @@ describe('XmlTest', function () {
'"_name":"todo",'+
'"_elements":[{"_type":"text",'+
'"_text":"Play"}]}]}]}'
- expect(result1).assertEqual(str1);
+ expect(result).assertEqual(str1);
})
/**
@@ -67,8 +72,13 @@ describe('XmlTest', function () {
' Work' +
' Play' +
'';
- let convertml = new ConvertXML();
- let result1 = convertml.convert(xml, {compact: false,trim :true})
+ let conv = new convertxml.ConvertXML();
+ let options = {trim : true, declarationKey:"_declaration",
+ instructionKey : "_instruction", attributesKey : "_attributes",
+ textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
+ commentKey : "_comment", parentKey : "_parent", typeKey : "_type",
+ nameKey : "_name", elementsKey : "_elements"}
+ let result = JSON.stringify(conv.convert(xml, options));
let str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"_type":"element",'+
@@ -87,7 +97,7 @@ describe('XmlTest', function () {
'"_name":"todo",'+
'"_elements":[{"_type":"text",'+
'"_text":"Play"}]}]}]}'
- expect(result1).assertEqual(str1);
+ expect(result).assertEqual(str1);
})
/**
@@ -104,8 +114,13 @@ describe('XmlTest', function () {
' Work' +
' Play' +
'';
- let convertml = new ConvertXML();
- let result1 = convertml.convert(xml, {compact: false, ignoreDeclaration: true});
+ let conv = new convertxml.ConvertXML();
+ let options = {trim : false, ignoreDeclaration: true, declarationKey:"_declaration",
+ instructionKey : "_instruction", attributesKey : "_attributes",
+ textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
+ commentKey : "_comment", parentKey : "_parent", typeKey : "_type",
+ nameKey : "_name", elementsKey : "_elements"}
+ let result = JSON.stringify(conv.convert(xml, options));
let str1 = '{"_elements":[{"_type":"element",'+
'"_name":"note",'+
'"_attributes":{"importance":"high",'+
@@ -122,7 +137,7 @@ describe('XmlTest', function () {
'"_name":"todo",'+
'"_elements":[{"_type":"text",'+
'"_text":"Play"}]}]}]}'
- expect(result1).assertEqual(str1);
+ expect(result).assertEqual(str1);
})
/**
@@ -140,8 +155,13 @@ describe('XmlTest', function () {
' Work' +
' Play' +
'';
- let convertml = new ConvertXML();
- let result1 = convertml.convert(xml, {compact: false, ignoreInstruction: true});
+ let conv = new convertxml.ConvertXML();
+ let options = {trim : false, ignoreInstruction: true, declarationKey:"_declaration",
+ instructionKey : "_instruction", attributesKey : "_attributes",
+ textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
+ commentKey : "_comment", parentKey : "_parent", typeKey : "_type",
+ nameKey : "_name", elementsKey : "_elements"}
+ let result = JSON.stringify(conv.convert(xml, options));
let str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"_type":"element",'+
@@ -161,7 +181,7 @@ describe('XmlTest', function () {
'"_name":"todo",'+
'"_elements":[{"_type":"text",'+
'"_text":"Play"}]}]}]}'
- expect(result1).assertEqual(str1);
+ expect(result).assertEqual(str1);
})
/**
@@ -178,8 +198,13 @@ describe('XmlTest', function () {
' Work' +
' Play' +
'';
- let convertml = new ConvertXML();
- let result1 = convertml.convert(xml, {compact: false, ignoreAttributes: true});
+ let conv = new convertxml.ConvertXML();
+ let options = {trim : false, ignoreAttributes : true, declarationKey:"_declaration",
+ instructionKey : "_instruction", attributesKey : "_attributes",
+ textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
+ commentKey : "_comment", parentKey : "_parent", typeKey : "_type",
+ nameKey : "_name", elementsKey : "_elements"}
+ let result = JSON.stringify(conv.convert(xml, options));
let str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"_type":"element",'+
@@ -196,7 +221,7 @@ describe('XmlTest', function () {
'"_name":"todo",'+
'"_elements":[{"_type":"text",'+
'"_text":"Play"}]}]}]}'
- expect(result1).assertEqual(str1);
+ expect(result).assertEqual(str1);
})
/**
@@ -214,8 +239,13 @@ describe('XmlTest', function () {
' Work' +
' Play' +
'';
- let convertml = new ConvertXML();
- let result1 = convertml.convert(xml, {compact: false, ignoreComment: true})
+ let conv = new convertxml.ConvertXML();
+ let options = {trim : false, declarationKey:"_declaration", ignoreComment: true,
+ instructionKey : "_instruction", attributesKey : "_attributes",
+ textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
+ commentKey : "_comment", parentKey : "_parent", typeKey : "_type",
+ nameKey : "_name", elementsKey : "_elements"}
+ let result = JSON.stringify(conv.convert(xml, options));
let str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"_type":"element",'+
@@ -234,7 +264,7 @@ describe('XmlTest', function () {
'"_name":"todo",'+
'"_elements":[{"_type":"text",'+
'"_text":"Play"}]}]}]}'
- expect(result1).assertEqual(str1);
+ expect(result).assertEqual(str1);
})
/**
@@ -252,8 +282,13 @@ describe('XmlTest', function () {
' Work' +
' Play' +
'';
- let convertml = new ConvertXML();
- let result1 = convertml.convert(xml, {compact: false, ignoreComment: true})
+ let conv = new convertxml.ConvertXML();
+ let options = {trim : false, ignoreComment: true, declarationKey:"_declaration",
+ instructionKey : "_instruction", attributesKey : "_attributes",
+ textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
+ commentKey : "_comment", parentKey : "_parent", typeKey : "_type",
+ nameKey : "_name", elementsKey : "_elements"}
+ let result = JSON.stringify(conv.convert(xml, options));
let str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"_type":"element",'+
@@ -272,7 +307,7 @@ describe('XmlTest', function () {
'"_name":"todo",'+
'"_elements":[{"_type":"text",'+
'"_text":"Play"}]}]}]}'
- expect(result1).assertEqual(str1);
+ expect(result).assertEqual(str1);
})
/**
@@ -290,8 +325,13 @@ describe('XmlTest', function () {
' Work' +
' Play' +
'';
- let convertml = new ConvertXML();
- let result1 = convertml.convert(xml, {compact: false, ignoreCDATA: true})
+ let conv = new convertxml.ConvertXML();
+ let options = {trim : false, declarationKey:"_declaration", ignoreCDATA: true,
+ instructionKey : "_instruction", attributesKey : "_attributes",
+ textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
+ commentKey : "_comment", parentKey : "_parent", typeKey : "_type",
+ nameKey : "_name", elementsKey : "_elements"}
+ let result = JSON.stringify(conv.convert(xml, options));
let str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"_type":"element",'+
@@ -310,63 +350,16 @@ describe('XmlTest', function () {
'"_name":"todo",'+
'"_elements":[{"_type":"text",'+
'"_text":"Play"}]}]}]}'
- expect(result1).assertEqual(str1);
+ expect(result).assertEqual(str1);
})
/**
- * @tc.name: testConvert009
+ * @tc.name: testConvert09
* @tc.desc: To convert XML text to JavaScript object.
* @tc.require: AR000GFB5B
* @tc.author: lihucheng
*/
- it('testConvert009', 0, function () {
- let xml =
- '' +
- '' +
- ' Happy' +
- '';
- let convertml = new ConvertXML();
- let result1 = convertml.convert(xml, {compact: false, spaces: 4})
- let str = '{\n'+
- ' "_declaration": {\n'+
- ' "_attributes": {\n'+
- ' "version": "1.0",\n'+
- ' "encoding": "utf-8"\n'+
- ' }\n'+
- ' },\n'+
- ' "_elements": [\n'+
- ' {\n'+
- ' "_type": "element",\n'+
- ' "_name": "note",\n'+
- ' "_attributes": {\n'+
- ' "importance": "high",\n'+
- ' "logged": "true"\n'+
- ' },\n'+
- ' "_elements": [\n'+
- ' {\n'+
- ' "_type": "element",\n'+
- ' "_name": "title",\n'+
- ' "_elements": [\n'+
- ' {\n'+
- ' "_type": "text",\n'+
- ' "_text": "Happy"\n'+
- ' }\n'+
- ' ]\n'+
- ' }\n'+
- ' ]\n'+
- ' }\n'+
- ' ]\n'+
- '}'
- expect(result1).assertEqual(str);
- })
-
- /**
- * @tc.name: testConvert010
- * @tc.desc: To convert XML text to JavaScript object.
- * @tc.require: AR000GFB5B
- * @tc.author: lihucheng
- */
- it('testConvert010', 0, function () {
+ it('testConvert09', 0, function () {
let xml =
'' +
''+
@@ -375,8 +368,13 @@ describe('XmlTest', function () {
' Work' +
' Play' +
'';
- let convertml = new ConvertXML();
- let result1 = convertml.convert(xml, {compact: false, ignoreDoctype: true})
+ let conv = new convertxml.ConvertXML();
+ let options = {trim : false, declarationKey:"_declaration", ignoreDoctype: true,
+ instructionKey : "_instruction", attributesKey : "_attributes",
+ textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
+ commentKey : "_comment", parentKey : "_parent", typeKey : "_type",
+ nameKey : "_name", elementsKey : "_elements"}
+ let result = JSON.stringify(conv.convert(xml, options));
let str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"_type":"element",'+
@@ -395,16 +393,16 @@ describe('XmlTest', function () {
'"_name":"todo",'+
'"_elements":[{"_type":"text",'+
'"_text":"Play"}]}]}]}'
- expect(result1).assertEqual(str1);
+ expect(result).assertEqual(str1);
})
/**
- * @tc.name: testConvert011
+ * @tc.name: testConvert010
* @tc.desc: To convert XML text to JavaScript object.
* @tc.require: AR000GFB5B
* @tc.author: lihucheng
*/
- it('testConvert011', 0, function () {
+ it('testConvert010', 0, function () {
let xml =
'' +
'' +
@@ -412,8 +410,13 @@ describe('XmlTest', function () {
' Work' +
' Play' +
'';
- let convertml = new ConvertXML();
- let result1 = convertml.convert(xml, {compact: false, ignoreText: true})
+ let conv = new convertxml.ConvertXML();
+ let options = {trim : false, ignoreText: true, declarationKey:"_declaration",
+ instructionKey : "_instruction", attributesKey : "_attributes",
+ textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
+ commentKey : "_comment", parentKey : "_parent", typeKey : "_type",
+ nameKey : "_name", elementsKey : "_elements"}
+ let result = JSON.stringify(conv.convert(xml, options));
let str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"_type":"element",'+
@@ -426,16 +429,16 @@ describe('XmlTest', function () {
'"_name":"todo"},'+
'{"_type":"element",'+
'"_name":"todo"}]}]}'
- expect(result1).assertEqual(str1);
+ expect(result).assertEqual(str1);
})
/**
- * @tc.name: testConvert012
+ * @tc.name: testConvert011
* @tc.desc: To convert XML text to JavaScript object.
* @tc.require: AR000GFB5B
* @tc.author: lihucheng
*/
- it('testConvert012', 0, function () {
+ it('testConvert011', 0, function () {
let xml =
'' +
'' +
@@ -443,8 +446,13 @@ describe('XmlTest', function () {
' Work' +
' Play' +
'';
- let convertml = new ConvertXML();
- let result1 = convertml.convert(xml, {compact: false, declarationKey: "123"})
+ let conv = new convertxml.ConvertXML();
+ let options = {trim : false, declarationKey: "123",
+ instructionKey : "_instruction", attributesKey : "_attributes",
+ textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
+ commentKey : "_comment", parentKey : "_parent", typeKey : "_type",
+ nameKey : "_name", elementsKey : "_elements"}
+ let result = JSON.stringify(conv.convert(xml, options));
let str1 = '{"123":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"_type":"element",'+
@@ -463,16 +471,16 @@ describe('XmlTest', function () {
'"_name":"todo",'+
'"_elements":[{"_type":"text",'+
'"_text":"Play"}]}]}]}'
- expect(result1).assertEqual(str1);
+ expect(result).assertEqual(str1);
})
/**
- * @tc.name: testConvert013
+ * @tc.name: testConvert012
* @tc.desc: To convert XML text to JavaScript object.
* @tc.require: AR000GFB5B
* @tc.author: lihucheng
*/
- it('testConvert013', 0, function () {
+ it('testConvert012', 0, function () {
let xml =
'' +
'' +
@@ -481,8 +489,13 @@ describe('XmlTest', function () {
' Work' +
' Play' +
'';
- let convertml = new ConvertXML();
- let result1 = convertml.convert(xml, {compact: false, instructionKey: "123"})
+ let conv = new convertxml.ConvertXML();
+ let options = {trim : false, declarationKey:"_declaration",
+ instructionKey : "123", attributesKey : "_attributes",
+ textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
+ commentKey : "_comment", parentKey : "_parent", typeKey : "_type",
+ nameKey : "_name", elementsKey : "_elements"}
+ let result = JSON.stringify(conv.convert(xml, options));
let str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"_type":"element",'+
@@ -504,16 +517,16 @@ describe('XmlTest', function () {
'"_name":"todo",'+
'"_elements":[{"_type":"text",'+
'"_text":"Play"}]}]}]}'
- expect(result1).assertEqual(str1);
+ expect(result).assertEqual(str1);
})
/**
- * @tc.name: testConvert014
+ * @tc.name: testConvert013
* @tc.desc: To convert XML text to JavaScript object.
* @tc.require: AR000GFB5B
* @tc.author: lihucheng
*/
- it('testConvert014', 0, function () {
+ it('testConvert013', 0, function () {
let xml =
'' +
'' +
@@ -522,8 +535,13 @@ describe('XmlTest', function () {
' Work' +
' Play' +
'';
- let convertml = new ConvertXML();
- let result1 = convertml.convert(xml, {compact: false, attributesKey: "123"})
+ let conv = new convertxml.ConvertXML();
+ let options = {trim : false, declarationKey:"_declaration",
+ instructionKey : "_instruction", attributesKey : "123",
+ textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
+ commentKey : "_comment", parentKey : "_parent", typeKey : "_type",
+ nameKey : "_name", elementsKey : "_elements"}
+ let result = JSON.stringify(conv.convert(xml, options));
let str1 = '{"_declaration":{"123":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"123":{"importance":"high",'+
@@ -545,16 +563,16 @@ describe('XmlTest', function () {
'"_name":"todo",'+
'"_elements":[{"_type":"text",'+
'"_text":"Play"}]}]}]}'
- expect(result1).assertEqual(str1);
+ expect(result).assertEqual(str1);
})
/**
- * @tc.name: testConvert015
+ * @tc.name: testConvert014
* @tc.desc: To convert XML text to JavaScript object.
* @tc.require: AR000GFB5B
* @tc.author: lihucheng
*/
- it('testConvert015', 0, function () {
+ it('testConvert014', 0, function () {
let xml =
'' +
'' +
@@ -562,8 +580,13 @@ describe('XmlTest', function () {
' Work' +
' Play' +
'';
- let convertml = new ConvertXML();
- let result1 = convertml.convert(xml, {compact: false, textKey: "123"})
+ let conv = new convertxml.ConvertXML();
+ let options = {trim : false, declarationKey:"_declaration",
+ instructionKey : "_instruction", attributesKey : "_attributes",
+ textKey : "123", cdataKey:"_cdata", doctypeKey : "_doctype",
+ commentKey : "_comment", parentKey : "_parent", typeKey : "_type",
+ nameKey : "_name", elementsKey : "_elements"}
+ let result = JSON.stringify(conv.convert(xml, options));
let str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"_type":"element",'+
@@ -582,16 +605,16 @@ describe('XmlTest', function () {
'"_name":"todo",'+
'"_elements":[{"123":"Play",'+
'"_type":"text"}]}]}]}'
- expect(result1).assertEqual(str1);
+ expect(result).assertEqual(str1);
})
/**
- * @tc.name: testConvert016
+ * @tc.name: testConvert015
* @tc.desc: To convert XML text to JavaScript object.
* @tc.require: AR000GFB5B
* @tc.author: lihucheng
*/
- it('testConvert016', 0, function () {
+ it('testConvert015', 0, function () {
let xml =
'' +
'' +
@@ -600,8 +623,13 @@ describe('XmlTest', function () {
' Work' +
' Play' +
'';
- let convertml = new ConvertXML();
- let result1 = convertml.convert(xml, {compact: false, cdataKey: "123"})
+ let conv = new convertxml.ConvertXML();
+ let options = {trim : false, declarationKey:"_declaration",
+ instructionKey : "_instruction", attributesKey : "_attributes",
+ textKey : "_text", cdataKey: "123", doctypeKey : "_doctype",
+ commentKey : "_comment", parentKey : "_parent", typeKey : "_type",
+ nameKey : "_name", elementsKey : "_elements"}
+ let result = JSON.stringify(conv.convert(xml, options));
let str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"_type":"element",'+
@@ -622,16 +650,16 @@ describe('XmlTest', function () {
'"_name":"todo",'+
'"_elements":[{"_type":"text",'+
'"_text":"Play"}]}]}]}'
- expect(result1).assertEqual(str1);
+ expect(result).assertEqual(str1);
})
/**
- * @tc.name: testConvert017
+ * @tc.name: testConvert016
* @tc.desc: To convert XML text to JavaScript object.
* @tc.require: AR000GFB5B
* @tc.author: lihucheng
*/
- it('testConvert017', 0, function () {
+ it('testConvert016', 0, function () {
let xml =
'' +
''+
@@ -640,8 +668,13 @@ describe('XmlTest', function () {
' Work' +
' Play' +
'';
- let convertml = new ConvertXML();
- let result1 = convertml.convert(xml, {compact: false, commentKey: "123"})
+ let conv = new convertxml.ConvertXML();
+ let options = {trim : false, declarationKey:"_declaration",
+ instructionKey : "_instruction", attributesKey : "_attributes",
+ textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
+ commentKey : "123", parentKey : "_parent", typeKey : "_type",
+ nameKey : "_name", elementsKey : "_elements"}
+ let result = JSON.stringify(conv.convert(xml, options));
let str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"123":"note",'+
@@ -662,16 +695,16 @@ describe('XmlTest', function () {
'"_name":"todo",'+
'"_elements":[{"_type":"text",'+
'"_text":"Play"}]}]}]}'
- expect(result1).assertEqual(str1);
+ expect(result).assertEqual(str1);
})
/**
- * @tc.name: testConvert018
+ * @tc.name: testConvert017
* @tc.desc: To convert XML text to JavaScript object.
* @tc.require: AR000GFB5B
* @tc.author: lihucheng
*/
- it('testConvert018', 0, function () {
+ it('testConvert017', 0, function () {
let xml =
'' +
'' +
@@ -680,8 +713,13 @@ describe('XmlTest', function () {
' Work' +
' Play' +
'';
- let convertml = new ConvertXML();
- let result1 = convertml.convert(xml, {compact: false, parentKey: "123"})
+ let conv = new convertxml.ConvertXML();
+ let options = {trim : false, declarationKey:"_declaration",
+ instructionKey : "_instruction", attributesKey : "_attributes",
+ textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
+ commentKey : "_comment", parentKey : "123", typeKey : "_type",
+ nameKey : "_name", elementsKey : "_elements"}
+ let result = JSON.stringify(conv.convert(xml, options));
let str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"_type":"element",'+
@@ -704,16 +742,16 @@ describe('XmlTest', function () {
'"_name":"todo",'+
'"_elements":[{"_type":"text",'+
'"_text":"Play"}]}]}]}'
- expect(result1).assertEqual(str1);
+ expect(result).assertEqual(str1);
})
/**
- * @tc.name: testConvert019
+ * @tc.name: testConvert018
* @tc.desc: To convert XML text to JavaScript object.
* @tc.require: AR000GFB5B
* @tc.author: lihucheng
*/
- it('testConvert019', 0, function () {
+ it('testConvert018', 0, function () {
let xml =
'' +
'' +
@@ -721,8 +759,13 @@ describe('XmlTest', function () {
' Work' +
' Play' +
'';
- let convertml = new ConvertXML();
- let result1 = convertml.convert(xml, {compact: false, typeKey: "123"})
+ let conv = new convertxml.ConvertXML();
+ let options = {trim : false, declarationKey:"_declaration",
+ instructionKey : "_instruction", attributesKey : "_attributes",
+ textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
+ commentKey : "_comment", parentKey : "_parent", typeKey : "123",
+ nameKey : "_name", elementsKey : "_elements"}
+ let result = JSON.stringify(conv.convert(xml, options));
let str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"123":"element",'+
@@ -741,16 +784,16 @@ describe('XmlTest', function () {
'"_name":"todo",'+
'"_elements":[{"123":"text",'+
'"_text":"Play"}]}]}]}'
- expect(result1).assertEqual(str1);
+ expect(result).assertEqual(str1);
})
/**
- * @tc.name: testConvert020
+ * @tc.name: testConvert019
* @tc.desc: To convert XML text to JavaScript object.
* @tc.require: AR000GFB5B
* @tc.author: lihucheng
*/
- it('testConvert020', 0, function () {
+ it('testConvert019', 0, function () {
let xml =
'' +
'' +
@@ -758,8 +801,13 @@ describe('XmlTest', function () {
' Work' +
' Play' +
'';
- let convertml = new ConvertXML();
- let result1 = convertml.convert(xml, {compact: false, nameKey: "123"})
+ let conv = new convertxml.ConvertXML();
+ let options = {trim : false, declarationKey:"_declaration",
+ instructionKey : "_instruction", attributesKey : "_attributes",
+ textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
+ commentKey : "_comment", parentKey : "_parent", typeKey : "_type",
+ nameKey : "123", elementsKey : "_elements"}
+ let result = JSON.stringify(conv.convert(xml, options));
let str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"123":"note",'+
@@ -778,16 +826,16 @@ describe('XmlTest', function () {
'"_type":"element",'+
'"_elements":[{"_type":"text",'+
'"_text":"Play"}]}]}]}'
- expect(result1).assertEqual(str1);
+ expect(result).assertEqual(str1);
})
/**
- * @tc.name: testConvert021
+ * @tc.name: testConvert020
* @tc.desc: To convert XML text to JavaScript object.
* @tc.require: AR000GFB5B
* @tc.author: lihucheng
*/
- it('testConvert021', 0, function () {
+ it('testConvert020', 0, function () {
let xml =
'' +
'' +
@@ -795,8 +843,13 @@ describe('XmlTest', function () {
' Work' +
' Play' +
'';
- let convertml = new ConvertXML();
- let result1 = convertml.convert(xml, {compact: false, elementsKey: "123"})
+ let conv = new convertxml.ConvertXML();
+ let options = {trim : false, declarationKey:"_declaration",
+ instructionKey : "_instruction", attributesKey : "_attributes",
+ textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
+ commentKey : "_comment", parentKey : "_parent", typeKey : "_type",
+ nameKey : "_name", elementsKey : "123"}
+ let result = JSON.stringify(conv.convert(xml, options));
let str1 = '{"123":[{"123":[{"123":[{"_type":"text",'+
'"_text":"Happy"}],'+
'"_type":"element",'+
@@ -815,329 +868,421 @@ describe('XmlTest', function () {
'"logged":"true"}}],'+
'"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}}}'
- expect(result1).assertEqual(str1);
+ expect(result).assertEqual(str1);
})
/**
- * @tc.name: testConvert022
+ * @tc.name: testConvert021
* @tc.desc: To convert XML text to JavaScript object.
* @tc.require: AR000GFB5B
* @tc.author: lihucheng
*/
- it('testConvert022', 0, function () {
+ it('testConvert021', 0, function () {
let xml = '';
- let convertml = new ConvertXML();
- let result1 = convertml.convert(xml, {compact: false})
+ let conv = new convertxml.ConvertXML();
+ let options = {trim : false, declarationKey:"_declaration",
+ instructionKey : "_instruction", attributesKey : "_attributes",
+ textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
+ commentKey : "_comment", parentKey : "_parent", typeKey : "_type",
+ nameKey : "_name", elementsKey : "_elements"}
+ let result = JSON.stringify(conv.convert(xml, options));
let str1 = '{"_declaration":{}}'
- expect(result1).assertEqual(str1);
+ expect(result).assertEqual(str1);
})
/**
- * @tc.name: testConvert023
+ * @tc.name: testConvert022
* @tc.desc: To convert XML text to JavaScript object.
* @tc.require: AR000GFB5B
* @tc.author: lihucheng
*/
- it('testConvert023', 0, function () {
+ it('testConvert022', 0, function () {
let xml = '';
- let convertml = new ConvertXML();
- let result1 = convertml.convert(xml, {compact: false})
+ let conv = new convertxml.ConvertXML();
+ let options = {trim : false, declarationKey:"_declaration",
+ instructionKey : "_instruction", attributesKey : "_attributes",
+ textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
+ commentKey : "_comment", parentKey : "_parent", typeKey : "_type",
+ nameKey : "_name", elementsKey : "_elements"}
+ let result = JSON.stringify(conv.convert(xml, options));
let str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}}}'
- expect(result1).assertEqual(str1);
+ expect(result).assertEqual(str1);
})
/**
- * @tc.name: testConvert024
+ * @tc.name: testConvert023
* @tc.desc: To convert XML text to JavaScript object.
* @tc.require: AR000GFB5B
* @tc.author: lihucheng
*/
- it('testConvert024', 0, function () {
+ it('testConvert023', 0, function () {
let xml = '\n';
- let convertml = new ConvertXML();
- let result1 = convertml.convert(xml, {compact: false})
+ let conv = new convertxml.ConvertXML();
+ let options = {trim : false, declarationKey:"_declaration",
+ instructionKey : "_instruction", attributesKey : "_attributes",
+ textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
+ commentKey : "_comment", parentKey : "_parent", typeKey : "_type",
+ nameKey : "_name", elementsKey : "_elements"}
+ let result = JSON.stringify(conv.convert(xml, options));
let str1 = '{"_declaration":{},"_elements":[{"_type":"element","_name":"a"}]}'
- expect(result1).assertEqual(str1);
+ expect(result).assertEqual(str1);
})
/**
- * @tc.name: testConvert025
+ * @tc.name: testConvert024
* @tc.desc: To convert XML text to JavaScript object.
* @tc.require: AR000GFB5B
* @tc.author: lihucheng
*/
- it('testConvert025', 0, function () {
+ it('testConvert024', 0, function () {
let xml = '';
- let convertml = new ConvertXML();
- let result1 = convertml.convert(xml, {compact: false})
+ let conv = new convertxml.ConvertXML();
+ let options = {trim : false, declarationKey:"_declaration",
+ instructionKey : "_instruction", attributesKey : "_attributes",
+ textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
+ commentKey : "_comment", parentKey : "_parent", typeKey : "_type",
+ nameKey : "_name", elementsKey : "_elements"}
+ let result = JSON.stringify(conv.convert(xml, options));
let str1 = '{"_elements":[{"_type":"instruction",'+
'"_name":"go",'+
'"_instruction":"there"}]}'
- expect(result1).assertEqual(str1);
+ expect(result).assertEqual(str1);
})
/**
- * @tc.name: testConvert026
+ * @tc.name: testConvert025
* @tc.desc: To convert XML text to JavaScript object.
* @tc.require: AR000GFB5B
* @tc.author: lihucheng
*/
- it('testConvert026', 0, function () {
+ it('testConvert025', 0, function () {
let xml = '';
- let convertml = new ConvertXML();
- let result1 = convertml.convert(xml, {compact: false})
+ let conv = new convertxml.ConvertXML();
+ let options = {trim : false, declarationKey:"_declaration",
+ instructionKey : "_instruction", attributesKey : "_attributes",
+ textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
+ commentKey : "_comment", parentKey : "_parent", typeKey : "_type",
+ nameKey : "_name", elementsKey : "_elements"}
+ let result = JSON.stringify(conv.convert(xml, options));
let str1 = '{"_elements":[{"_type":"instruction",'+
'"_name":"go",'+
'"_instruction":"there"},'+
'{"_type":"instruction",'+
'"_name":"come",'+
'"_instruction":"here"}]}'
- expect(result1).assertEqual(str1);
+ expect(result).assertEqual(str1);
})
/**
- * @tc.name: testConvert027
+ * @tc.name: testConvert026
* @tc.desc: To convert XML text to JavaScript object.
* @tc.require: AR000GFB5B
* @tc.author: lihucheng
*/
- it('testConvert027', 0, function () {
+ it('testConvert026', 0, function () {
let xml = '';
- let convertml = new ConvertXML();
- let result1 = convertml.convert(xml, {compact: false})
+ let conv = new convertxml.ConvertXML();
+ let options = {trim : false, declarationKey:"_declaration",
+ instructionKey : "_instruction", attributesKey : "_attributes",
+ textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
+ commentKey : "_comment", parentKey : "_parent", typeKey : "_type",
+ nameKey : "_name", elementsKey : "_elements"}
+ let result = JSON.stringify(conv.convert(xml, options));
let str1 = '{"_elements":[{"_type":"comment","_comment":"'+
- ' \t'+
+ ' \\t'+
' Hello '+
'World! '+
- '\t '+
+ '\\t '+
'"}]}'
- expect(result1).assertEqual(str1);
+ expect(result).assertEqual(str1);
})
/**
- * @tc.name: testConvert028
+ * @tc.name: testConvert027
* @tc.desc: To convert XML text to JavaScript object.
* @tc.require: AR000GFB5B
* @tc.author: lihucheng
*/
- it('testConvert028', 0, function () {
+ it('testConvert027', 0, function () {
let xml = '\n';
- let convertml = new ConvertXML();
- let result1 = convertml.convert(xml, {compact: false})
+ let conv = new convertxml.ConvertXML();
+ let options = {trim : false, declarationKey:"_declaration",
+ instructionKey : "_instruction", attributesKey : "_attributes",
+ textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
+ commentKey : "_comment", parentKey : "_parent", typeKey : "_type",
+ nameKey : "_name", elementsKey : "_elements"}
+ let result = JSON.stringify(conv.convert(xml, options));
let str1 = '{"_elements":[{"_type":"comment","_comment":"'+
- ' \t'+
+ ' \\t'+
' Hello '+
- '\t '+
+ '\\t '+
'"},{"_type":"comment","_comment":"'+
- ' \t'+
+ ' \\t'+
' World '+
- '\t '+
+ '\\t '+
'"}]}'
- expect(result1).assertEqual(str1);
+ expect(result).assertEqual(str1);
})
/**
- * @tc.name: testConvert029
+ * @tc.name: testConvert028
* @tc.desc: To convert XML text to JavaScript object.
* @tc.require: AR000GFB5B
* @tc.author: lihucheng
*/
- it('testConvert029', 0, function () {
+ it('testConvert028', 0, function () {
let xml = ' \t ]]>';
- let convertml = new ConvertXML();
- let result1 = convertml.convert(xml, {compact: false})
+ let conv = new convertxml.ConvertXML();
+ let options = {trim : false, declarationKey:"_declaration",
+ instructionKey : "_instruction", attributesKey : "_attributes",
+ textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
+ commentKey : "_comment", parentKey : "_parent", typeKey : "_type",
+ nameKey : "_name", elementsKey : "_elements"}
+ let result = JSON.stringify(conv.convert(xml, options));
let str1 = '{"_elements":[{"_type":"cdata","_cdata":"'+
- ' \t'+
+ ' \\t'+
' '+
- '\t '+
+ '\\t '+
'"}]}'
- expect(result1).assertEqual(str1);
+ expect(result).assertEqual(str1);
})
/**
- * @tc.name: testConvert030
+ * @tc.name: testConvert029
* @tc.desc: To convert XML text to JavaScript object.
* @tc.require: AR000GFB5B
* @tc.author: lihucheng
*/
- it('testConvert030', 0, function () {
+ it('testConvert029', 0, function () {
let xml = ' " and & \t ]]>';
- let convertml = new ConvertXML();
- let result1 = convertml.convert(xml, {compact: false})
+ let conv = new convertxml.ConvertXML();
+ let options = {trim : false, declarationKey:"_declaration",
+ instructionKey : "_instruction", attributesKey : "_attributes",
+ textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
+ commentKey : "_comment", parentKey : "_parent", typeKey : "_type",
+ nameKey : "_name", elementsKey : "_elements"}
+ let result = JSON.stringify(conv.convert(xml, options));
+ console.log("LHC..." + result);
let str1 = '{"_elements":[{"_type":"cdata","_cdata":"'+
- ' \t'+
+ ' \\t'+
' data"},{"_type":"cdata","_cdata":"< '+
'> '+
- '"'+
+ '\\"'+
' and'+
' & '+
- '\t '+
- '"}]}'
- expect(result1).assertEqual(str1);
+ '\\t '+
+ '"}]}';
+ console.log("LHC..." + str1);
+ expect(result).assertEqual(str1);
})
/**
- * @tc.name: testConvert031
+ * @tc.name: testConvert030
* @tc.desc: To convert XML text to JavaScript object.
* @tc.require: AR000GFB5B
* @tc.author: lihucheng
*/
- it('testConvert031', 0, function () {
+ it('testConvert030', 0, function () {
let xml = '';
- let convertml = new ConvertXML();
- let result1 = convertml.convert(xml, {compact: false})
+ let conv = new convertxml.ConvertXML();
+ let options = {trim : false, declarationKey:"_declaration",
+ instructionKey : "_instruction", attributesKey : "_attributes",
+ textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
+ commentKey : "_comment", parentKey : "_parent", typeKey : "_type",
+ nameKey : "_name", elementsKey : "_elements"}
+ let result = JSON.stringify(conv.convert(xml, options));
let str1 = '{"_elements":[{"_type":"element",'+
'"_name":"a"}]}'
- expect(result1).assertEqual(str1);
+ expect(result).assertEqual(str1);
})
/**
- * @tc.name: testConvert032
+ * @tc.name: testConvert031
* @tc.desc: To convert XML text to JavaScript object.
* @tc.require: AR000GFB5B
* @tc.author: lihucheng
*/
- it('testConvert032', 0, function () {
+ it('testConvert031', 0, function () {
let xml = '\n';
- let convertml = new ConvertXML();
- let result1 = convertml.convert(xml, {compact : false})
+ let conv = new convertxml.ConvertXML();
+ let options = {trim : false, declarationKey:"_declaration",
+ instructionKey : "_instruction", attributesKey : "_attributes",
+ textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
+ commentKey : "_comment", parentKey : "_parent", typeKey : "_type",
+ nameKey : "_name", elementsKey : "_elements"}
+ let result = JSON.stringify(conv.convert(xml, options));
let str1 = '{"_elements":[{"_type":"element",'+
'"_name":"a"},'+
'{"_type":"element",'+
'"_name":"a"}]}'
- expect(result1).assertEqual(str1);
+ expect(result).assertEqual(str1);
})
/**
- * @tc.name: testConvert033
+ * @tc.name: testConvert032
* @tc.desc: To convert XML text to JavaScript object.
* @tc.require: AR000GFB5B
* @tc.author: lihucheng
*/
- it('testConvert033', 0, function () {
+ it('testConvert032', 0, function () {
let xml = '\n';
- let convertml = new ConvertXML();
- let result1 = convertml.convert(xml, {compact: false})
+ let conv = new convertxml.ConvertXML();
+ let options = {trim : false, declarationKey:"_declaration",
+ instructionKey : "_instruction", attributesKey : "_attributes",
+ textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
+ commentKey : "_comment", parentKey : "_parent", typeKey : "_type",
+ nameKey : "_name", elementsKey : "_elements"}
+ let result = JSON.stringify(conv.convert(xml, options));
let str1 = '{"_elements":[{"_type":"element",'+
'"_name":"a"},'+
'{"_type":"element",'+
'"_name":"b"}]}'
- expect(result1).assertEqual(str1);
+ expect(result).assertEqual(str1);
})
/**
- * @tc.name: testConvert034
+ * @tc.name: testConvert033
* @tc.desc: To convert XML text to JavaScript object.
* @tc.require: AR000GFB5B
* @tc.author: lihucheng
*/
- it('testConvert034', 0, function () {
+ it('testConvert033', 0, function () {
let xml = '';
- let convertml = new ConvertXML();
- let result1 = convertml.convert(xml, {compact: false})
+ let conv = new convertxml.ConvertXML();
+ let options = {trim : false, declarationKey:"_declaration",
+ instructionKey : "_instruction", attributesKey : "_attributes",
+ textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
+ commentKey : "_comment", parentKey : "_parent", typeKey : "_type",
+ nameKey : "_name", elementsKey : "_elements"}
+ let result = JSON.stringify(conv.convert(xml, options));
let str1 = '{"_elements":[{"_type":"element",'+
'"_name":"a",'+
'"_attributes":{"x":"hello"}}]}'
- expect(result1).assertEqual(str1);
+ expect(result).assertEqual(str1);
})
/**
- * @tc.name: testConvert035
+ * @tc.name: testConvert034
* @tc.desc: To convert XML text to JavaScript object.
* @tc.require: AR000GFB5B
* @tc.author: lihucheng
*/
- it('testConvert035', 0, function () {
+ it('testConvert034', 0, function () {
let xml = '';
- let convertml = new ConvertXML();
- let result1 = convertml.convert(xml, {compact: false})
+ let conv = new convertxml.ConvertXML();
+ let options = {trim : false, declarationKey:"_declaration",
+ instructionKey : "_instruction", attributesKey : "_attributes",
+ textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
+ commentKey : "_comment", parentKey : "_parent", typeKey : "_type",
+ nameKey : "_name", elementsKey : "_elements"}
+ let result = JSON.stringify(conv.convert(xml, options));
let str1 = '{"_elements":[{"_type":"element",'+
'"_name":"a",'+
'"_attributes":{"x":"1.234",'+
'"y":"It\'s"}}]}'
- expect(result1).assertEqual(str1);
+ expect(result).assertEqual(str1);
})
/**
- * @tc.name: testConvert036
+ * @tc.name: testConvert035
* @tc.desc: To convert XML text to JavaScript object.
* @tc.require: AR000GFB5B
* @tc.author: lihucheng
*/
- it('testConvert036', 0, function () {
+ it('testConvert035', 0, function () {
let xml = ' \t Hi \t ';
- let convertml = new ConvertXML();
- let result1 = convertml.convert(xml, {compact: false})
+ let conv = new convertxml.ConvertXML();
+ let options = {trim : false, declarationKey:"_declaration",
+ instructionKey : "_instruction", attributesKey : "_attributes",
+ textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
+ commentKey : "_comment", parentKey : "_parent", typeKey : "_type",
+ nameKey : "_name", elementsKey : "_elements"}
+ let result = JSON.stringify(conv.convert(xml, options));
let str1 = '{"_elements":[{"_type":"element","_name":"a","_elements":[{"_type":"text","_text":"'+
- ' \t'+
+ ' \\t'+
' Hi '+
- '\t '+
+ '\\t '+
'"}]}]}';
- expect(result1).assertEqual(str1);
+ expect(result).assertEqual(str1);
})
/**
- * @tc.name: testConvert037
+ * @tc.name: testConvert036
* @tc.desc: To convert XML text to JavaScript object.
* @tc.require: AR000GFB5B
* @tc.author: lihucheng
*/
- it('testConvert037', 0, function () {
+ it('testConvert036', 0, function () {
let xml = ' Hi There \t ';
- let convertml = new ConvertXML();
- let result1 = convertml.convert(xml, {compact: false})
+ let conv = new convertxml.ConvertXML();
+ let options = {trim : false, declarationKey:"_declaration",
+ instructionKey : "_instruction", attributesKey : "_attributes",
+ textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
+ commentKey : "_comment", parentKey : "_parent", typeKey : "_type",
+ nameKey : "_name", elementsKey : "_elements"}
+ let result = JSON.stringify(conv.convert(xml, options));
let str1 = '{"_elements":[{"_type":"element","_name":"a","_elements":[{"_type":"text","_text":"'+
' Hi '+
' There '+
- '\t '+
+ '\\t '+
'"}]}]}'
- expect(result1).assertEqual(str1);
+ expect(result).assertEqual(str1);
})
/**
- * @tc.name: testConvert038
+ * @tc.name: testConvert037
* @tc.desc: To convert XML text to JavaScript object.
* @tc.require: AR000GFB5B
* @tc.author: lihucheng
*/
- it('testConvert038', 0, function () {
+ it('testConvert037', 0, function () {
let xml = '\n\v\n';
- let convertml = new ConvertXML();
- let result1 = convertml.convert(xml, {compact: false})
+ let conv = new convertxml.ConvertXML();
+ let options = {trim : false, declarationKey:"_declaration",
+ instructionKey : "_instruction", attributesKey : "_attributes",
+ textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
+ commentKey : "_comment", parentKey : "_parent", typeKey : "_type",
+ nameKey : "_name", elementsKey : "_elements"}
+ let result = JSON.stringify(conv.convert(xml, options));
let str1 = '{"_elements":[{"_type":"element",'+
'"_name":"a",'+
'"_elements":[{"_type":"element",'+
'"_name":"b"}]}]}'
- expect(result1).assertEqual(str1);
+ expect(result).assertEqual(str1);
})
/**
- * @tc.name: testConvert039
+ * @tc.name: testConvert038
* @tc.desc: To convert XML text to JavaScript object.
* @tc.require: AR000GFB5B
* @tc.author: lihucheng
*/
- it('testConvert039', 0, function () {
+ it('testConvert038', 0, function () {
let xml = '\n\v\n\v\v\n\v\n';
- let convertml = new ConvertXML();
- let result1 = convertml.convert(xml, {compact: false})
+ let conv = new convertxml.ConvertXML();
+ let options = {trim : false, declarationKey:"_declaration",
+ instructionKey : "_instruction", attributesKey : "_attributes",
+ textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
+ commentKey : "_comment", parentKey : "_parent", typeKey : "_type",
+ nameKey : "_name", elementsKey : "_elements"}
+ let result = JSON.stringify(conv.convert(xml, options));
let str1 = '{"_elements":[{"_type":"element",'+
'"_name":"a",'+
'"_elements":[{"_type":"element",'+
'"_name":"b",'+
'"_elements":[{"_type":"element",'+
'"_name":"c"}]}]}]}'
- expect(result1).assertEqual(str1);
+ expect(result).assertEqual(str1);
})
/**
- * @tc.name: testConvert040
+ * @tc.name: testConvert039
* @tc.desc: To convert XML text to JavaScript object.
* @tc.require: AR000GFB5B
* @tc.author: lihucheng
*/
- it('testConvert040', 0, function () {
+ it('testConvert039', 0, function () {
let xml =
'' +
''+
@@ -1146,8 +1291,13 @@ describe('XmlTest', function () {
' Work' +
' Play' +
'';
- let convertml = new ConvertXML();
- let result1 = convertml.convert(xml, {compact: false, doctypeKey: 'doctype'})
+ let conv = new convertxml.ConvertXML();
+ let options = {trim : false, declarationKey:"_declaration",
+ instructionKey : "_instruction", attributesKey : "_attributes",
+ textKey : "_text", cdataKey:"_cdata", doctypeKey : "doctype",
+ commentKey : "_comment", parentKey : "_parent", typeKey : "_type",
+ nameKey : "_name", elementsKey : "_elements"}
+ let result = JSON.stringify(conv.convert(xml, options));
let str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+
'"_elements":[{"_type":"doctype","doctype":"foo"},'+
@@ -1167,6 +1317,6 @@ describe('XmlTest', function () {
'"_name":"todo",'+
'"_elements":[{"_type":"text",'+
'"_text":"Play"}]}]}]}'
- expect(result1).assertEqual(str1);
+ expect(result).assertEqual(str1);
})
})
\ No newline at end of file