提交 829498d9 编写于 作者: S shikai-123

Signed-off-by: shikai-123 <lifansheng1@huawei.com>

Modify xts of xml/convertxml
上级 71e34048
...@@ -291,7 +291,7 @@ describe('XmlTest', function () { ...@@ -291,7 +291,7 @@ describe('XmlTest', function () {
' <todo>Play</todo>' + ' <todo>Play</todo>' +
'</note>'; '</note>';
var convertml = new convertXml.ConvertXML(); var convertml = new convertXml.ConvertXML();
var result1 = convertml.convert(xml, {compact: false, ignoreCdata: true}) var result1 = convertml.convert(xml, {compact: false, ignoreCDATA: true})
var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+ var str1 = '{"_declaration":{"_attributes":{"version":"1.0",'+
'"encoding":"utf-8"}},'+ '"encoding":"utf-8"}},'+
'"_elements":[{"_type":"element",'+ '"_elements":[{"_type":"element",'+
......
...@@ -803,17 +803,17 @@ describe('XmlSerializerXmlPullParserTest', function () { ...@@ -803,17 +803,17 @@ describe('XmlSerializerXmlPullParserTest', function () {
}) })
/** /**
* @tc.name: testSetCommnet001 * @tc.name: testSetComment001
* @tc.desc: Writes the commnet. * @tc.desc: Writes the comment.
* @tc.require: AR000GGRB8 * @tc.require: AR000GGRB8
* @tc.author: lihucheng * @tc.author: lihucheng
*/ */
it('testSetCommnet001', 0, function () { it('testSetComment001', 0, function () {
const myMAX = 2048; const myMAX = 2048;
var arrayBuffer = new ArrayBuffer(myMAX); var arrayBuffer = new ArrayBuffer(myMAX);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.startElement("note"); thatSer.startElement("note");
thatSer.setCommnet("Hi!"); thatSer.setComment("Hi!");
thatSer.endElement(); thatSer.endElement();
var result = '<note>\r\n <!--Hi!-->\r\n</note>'; var result = '<note>\r\n <!--Hi!-->\r\n</note>';
var view = new Uint8Array(arrayBuffer); var view = new Uint8Array(arrayBuffer);
...@@ -825,17 +825,17 @@ describe('XmlSerializerXmlPullParserTest', function () { ...@@ -825,17 +825,17 @@ describe('XmlSerializerXmlPullParserTest', function () {
}) })
/** /**
* @tc.name: testSetCommnet002 * @tc.name: testSetComment002
* @tc.desc: Writes the commnet. * @tc.desc: Writes the comment.
* @tc.require: AR000GGRB8 * @tc.require: AR000GGRB8
* @tc.author: lihucheng * @tc.author: lihucheng
*/ */
it('testSetCommnet002', 0, function () { it('testSetComment002', 0, function () {
const myMAX = 2048; const myMAX = 2048;
var arrayBuffer = new ArrayBuffer(myMAX); var arrayBuffer = new ArrayBuffer(myMAX);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.startElement("note"); thatSer.startElement("note");
thatSer.setCommnet("Hello, World!"); thatSer.setComment("Hello, World!");
thatSer.endElement(); thatSer.endElement();
var result = '<note>\r\n <!--Hello, World!-->\r\n</note>'; var result = '<note>\r\n <!--Hello, World!-->\r\n</note>';
var view = new Uint8Array(arrayBuffer); var view = new Uint8Array(arrayBuffer);
...@@ -847,16 +847,16 @@ describe('XmlSerializerXmlPullParserTest', function () { ...@@ -847,16 +847,16 @@ describe('XmlSerializerXmlPullParserTest', function () {
}) })
/** /**
* @tc.name: testSetCommnet003 * @tc.name: testSetComment003
* @tc.desc: Writes the commnet. * @tc.desc: Writes the comment.
* @tc.require: AR000GGRB8 * @tc.require: AR000GGRB8
* @tc.author: lihucheng * @tc.author: lihucheng
*/ */
it('testSetCommnet003', 0, function () { it('testSetComment003', 0, function () {
const myMAX = 2048; const myMAX = 2048;
var arrayBuffer = new ArrayBuffer(myMAX); var arrayBuffer = new ArrayBuffer(myMAX);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.setCommnet("Hello, World!"); thatSer.setComment("Hello, World!");
var result = '<!--Hello, World!-->'; var result = '<!--Hello, World!-->';
var view = new Uint8Array(arrayBuffer); var view = new Uint8Array(arrayBuffer);
var view1 = ""; var view1 = "";
...@@ -867,16 +867,16 @@ describe('XmlSerializerXmlPullParserTest', function () { ...@@ -867,16 +867,16 @@ describe('XmlSerializerXmlPullParserTest', function () {
}) })
/** /**
* @tc.name: testSetCommnet004 * @tc.name: testSetComment004
* @tc.desc: Writes the commnet. * @tc.desc: Writes the comment.
* @tc.require: AR000GGRB8 * @tc.require: AR000GGRB8
* @tc.author: lihucheng * @tc.author: lihucheng
*/ */
it('testSetCommnet004', 0, function () { it('testSetComment004', 0, function () {
const myMAX = 2048; const myMAX = 2048;
var arrayBuffer = new ArrayBuffer(myMAX); var arrayBuffer = new ArrayBuffer(myMAX);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.setCommnet("Hello, World!"); thatSer.setComment("Hello, World!");
var result = '<!--Hello, World!-->'; var result = '<!--Hello, World!-->';
var view = new Uint8Array(arrayBuffer); var view = new Uint8Array(arrayBuffer);
var view1 = ""; var view1 = "";
...@@ -887,16 +887,16 @@ describe('XmlSerializerXmlPullParserTest', function () { ...@@ -887,16 +887,16 @@ describe('XmlSerializerXmlPullParserTest', function () {
}) })
/** /**
* @tc.name: testSetCommnet005 * @tc.name: testSetComment005
* @tc.desc: Writes the commnet. * @tc.desc: Writes the comment.
* @tc.require: AR000GGRB8 * @tc.require: AR000GGRB8
* @tc.author: lihucheng * @tc.author: lihucheng
*/ */
it('testSetCommnet005', 0, function () { it('testSetComment005', 0, function () {
const myMAX = 2048; const myMAX = 2048;
var arrayBuffer = new ArrayBuffer(myMAX); var arrayBuffer = new ArrayBuffer(myMAX);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.setCommnet("Hello, World!"); thatSer.setComment("Hello, World!");
thatSer.startElement("note"); thatSer.startElement("note");
thatSer.endElement(); thatSer.endElement();
var result = '<!--Hello, World!-->\r\n<note/>'; var result = '<!--Hello, World!-->\r\n<note/>';
...@@ -1015,16 +1015,16 @@ describe('XmlSerializerXmlPullParserTest', function () { ...@@ -1015,16 +1015,16 @@ describe('XmlSerializerXmlPullParserTest', function () {
}) })
/** /**
* @tc.name: testSetCData001 * @tc.name: testSetCDATA001
* @tc.desc: Writes the CDATA. * @tc.desc: Writes the CDATA.
* @tc.require: AR000GGRB8 * @tc.require: AR000GGRB8
* @tc.author: lihucheng * @tc.author: lihucheng
*/ */
it('testSetCData001', 0, function () { it('testSetCDATA001', 0, function () {
const myMAX = 2048; const myMAX = 2048;
var arrayBuffer = new ArrayBuffer(myMAX); var arrayBuffer = new ArrayBuffer(myMAX);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.setCData('root SYSTEM') thatSer.setCDATA('root SYSTEM')
var result = '<![CDATA[root SYSTEM]]>'; var result = '<![CDATA[root SYSTEM]]>';
var view = new Uint8Array(arrayBuffer); var view = new Uint8Array(arrayBuffer);
var view1 = ""; var view1 = "";
...@@ -1035,16 +1035,16 @@ describe('XmlSerializerXmlPullParserTest', function () { ...@@ -1035,16 +1035,16 @@ describe('XmlSerializerXmlPullParserTest', function () {
}) })
/** /**
* @tc.name: testSetCData002 * @tc.name: testSetCDATA002
* @tc.desc: Writes the CDATA. * @tc.desc: Writes the CDATA.
* @tc.require: AR000GGRB8 * @tc.require: AR000GGRB8
* @tc.author: lihucheng * @tc.author: lihucheng
*/ */
it('testSetCData002', 0, function () { it('testSetCDATA002', 0, function () {
const myMAX = 2048; const myMAX = 2048;
var arrayBuffer = new ArrayBuffer(myMAX); var arrayBuffer = new ArrayBuffer(myMAX);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.setCData('root SYSTEM "http://www.test.org/test.dtd"') thatSer.setCDATA('root SYSTEM "http://www.test.org/test.dtd"')
var result = '<![CDATA[root SYSTEM "http://www.test.org/test.dtd"]]>'; var result = '<![CDATA[root SYSTEM "http://www.test.org/test.dtd"]]>';
var view = new Uint8Array(arrayBuffer); var view = new Uint8Array(arrayBuffer);
var view1 = ""; var view1 = "";
...@@ -1055,18 +1055,18 @@ describe('XmlSerializerXmlPullParserTest', function () { ...@@ -1055,18 +1055,18 @@ describe('XmlSerializerXmlPullParserTest', function () {
}) })
/** /**
* @tc.name: testSetCData003 * @tc.name: testSetCDATA003
* @tc.desc: Writes the CDATA. * @tc.desc: Writes the CDATA.
* @tc.require: AR000GGRB8 * @tc.require: AR000GGRB8
* @tc.author: lihucheng * @tc.author: lihucheng
*/ */
it('testSetCData003', 0, function () { it('testSetCDATA003', 0, function () {
const myMAX = 2048; const myMAX = 2048;
var arrayBuffer = new ArrayBuffer(myMAX); var arrayBuffer = new ArrayBuffer(myMAX);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.startElement("note"); thatSer.startElement("note");
thatSer.endElement(); thatSer.endElement();
thatSer.setCData('root SYSTEM "http://www.test.org/test.dtd"') thatSer.setCDATA('root SYSTEM "http://www.test.org/test.dtd"')
var result = '<note/>\r\n<![CDATA[root SYSTEM "http://www.test.org/test.dtd"]]>'; var result = '<note/>\r\n<![CDATA[root SYSTEM "http://www.test.org/test.dtd"]]>';
var view = new Uint8Array(arrayBuffer); var view = new Uint8Array(arrayBuffer);
var view1 = ""; var view1 = "";
...@@ -1077,16 +1077,16 @@ describe('XmlSerializerXmlPullParserTest', function () { ...@@ -1077,16 +1077,16 @@ describe('XmlSerializerXmlPullParserTest', function () {
}) })
/** /**
* @tc.name: testSetCData004 * @tc.name: testSetCDATA004
* @tc.desc: Writes the CDATA. * @tc.desc: Writes the CDATA.
* @tc.require: AR000GGRB8 * @tc.require: AR000GGRB8
* @tc.author: lihucheng * @tc.author: lihucheng
*/ */
it('testSetCData004', 0, function () { it('testSetCDATA004', 0, function () {
const myMAX = 2048; const myMAX = 2048;
var arrayBuffer = new ArrayBuffer(myMAX); var arrayBuffer = new ArrayBuffer(myMAX);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.setCData('root SYSTEM "http://www.test.org/test.dtd"') thatSer.setCDATA('root SYSTEM "http://www.test.org/test.dtd"')
thatSer.startElement("note"); thatSer.startElement("note");
thatSer.endElement(); thatSer.endElement();
var result = '<![CDATA[root SYSTEM "http://www.test.org/test.dtd"]]>\r\n<note/>'; var result = '<![CDATA[root SYSTEM "http://www.test.org/test.dtd"]]>\r\n<note/>';
...@@ -1099,17 +1099,17 @@ describe('XmlSerializerXmlPullParserTest', function () { ...@@ -1099,17 +1099,17 @@ describe('XmlSerializerXmlPullParserTest', function () {
}) })
/** /**
* @tc.name: testSetCData005 * @tc.name: testSetCDATA005
* @tc.desc: Writes the CDATA. * @tc.desc: Writes the CDATA.
* @tc.require: AR000GGRB8 * @tc.require: AR000GGRB8
* @tc.author: lihucheng * @tc.author: lihucheng
*/ */
it('testSetCData005', 0, function () { it('testSetCDATA005', 0, function () {
const myMAX = 2048; const myMAX = 2048;
var arrayBuffer = new ArrayBuffer(myMAX); var arrayBuffer = new ArrayBuffer(myMAX);
var thatSer = new xml.XmlSerializer(arrayBuffer); var thatSer = new xml.XmlSerializer(arrayBuffer);
thatSer.startElement("note"); thatSer.startElement("note");
thatSer.setCData('root SYSTEM "http://www.test.org/test.dtd"') thatSer.setCDATA('root SYSTEM "http://www.test.org/test.dtd"')
thatSer.endElement(); thatSer.endElement();
var result = '<note>\r\n <![CDATA[root SYSTEM "http://www.test.org/test.dtd"]]>\r\n</note>'; var result = '<note>\r\n <![CDATA[root SYSTEM "http://www.test.org/test.dtd"]]>\r\n</note>';
var view = new Uint8Array(arrayBuffer); var view = new Uint8Array(arrayBuffer);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册