From f40b3e8b15da7a1bf2e0874c83dc7a92e17320de Mon Sep 17 00:00:00 2001 From: Steve Hamblett Date: Tue, 1 Apr 2025 11:25:05 +0100 Subject: [PATCH 1/4] DCM fixes --- analysis_options.yaml | 16 ++++++++++++++++ pubspec.yaml | 1 + 2 files changed, 17 insertions(+) diff --git a/analysis_options.yaml b/analysis_options.yaml index 0d65f71..cdcb113 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -10,3 +10,19 @@ analyzer: exclude: - test/issues/** - test/xml2json_test_strings.dart + - +dart_code_metrics: + exclude: + metrics: + - test/** + - example/** + rules: + - test/** + - example/** + extends: + - package:dart_code_metrics_presets/dart_all.yaml + rules: + - avoid-dynamic : false + - avoid-non-null-assertion : false + - newline-before-return : false + - avoid-late-keyword : false diff --git a/pubspec.yaml b/pubspec.yaml index fe3ea60..c07a220 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -19,6 +19,7 @@ dev_dependencies: build_runner: '^2.4.14' build_test: '^2.2.3' build_web_compilers: '^4.1.0' + dart_code_metrics_presets: '^2.21.0' topics: - conversion From 311ffb849a22ab64d717e8445e225c589527dccf Mon Sep 17 00:00:00 2001 From: Steve Hamblett Date: Wed, 2 Apr 2025 10:28:23 +0100 Subject: [PATCH 2/4] DCM fixes --- lib/src/xml2json.dart | 30 ++++++++++++--------- lib/src/xml2json_badgerfish.dart | 28 ++++++++++--------- lib/src/xml2json_exception.dart | 4 +-- lib/src/xml2json_gdata.dart | 27 ++++++++++--------- lib/src/xml2json_open_rally.dart | 33 ++++++++++++----------- lib/src/xml2json_parker.dart | 32 +++++++++++----------- lib/src/xml2json_parker_with_attrs.dart | 36 +++++++++++++------------ lib/src/xml2json_utils.dart | 6 +++-- 8 files changed, 106 insertions(+), 90 deletions(-) diff --git a/lib/src/xml2json.dart b/lib/src/xml2json.dart index 7198f17..10b1e44 100644 --- a/lib/src/xml2json.dart +++ b/lib/src/xml2json.dart @@ -54,9 +54,9 @@ class Xml2Json { final xmlStringPrep = _Xml2JsonUtils.prepareXmlString(xmlString); try { _result = XmlDocument.parse(xmlStringPrep); - } on Object { + } on Object catch (_, stack) { const errorString = 'parse error - invalid XML'; - throw Xml2JsonException(errorString); + Error.throwWithStackTrace(Xml2JsonException(errorString), stack); } } @@ -70,8 +70,9 @@ class Xml2Json { final badgerfishTransformer = _Xml2JsonBadgerfish(useLocalNameForNodes); try { json = badgerfishTransformer.transform(_result); - } on Exception catch (e) { - throw Xml2JsonException('toBadgerfish error => ${e.toString()}'); + } on Exception catch (e, stack) { + Error.throwWithStackTrace( + Xml2JsonException('toBadgerfish error => ${e.toString()}'), stack); } return json; @@ -87,8 +88,9 @@ class Xml2Json { final openRallyTransformer = _Xml2JsonOpenRally(); try { json = openRallyTransformer.transform(_result); - } on Exception catch (e) { - throw Xml2JsonException('toOpenRally error => ${e.toString()}'); + } on Exception catch (e, stack) { + Error.throwWithStackTrace( + Xml2JsonException('toOpenRally error => ${e.toString()}'), stack); } return json; @@ -104,8 +106,9 @@ class Xml2Json { final parkerTransformer = _Xml2JsonParker(); try { json = parkerTransformer.transform(_result); - } on Exception catch (e) { - throw Xml2JsonException('toParker error => ${e.toString()}'); + } on Exception catch (e, stack) { + Error.throwWithStackTrace( + Xml2JsonException('toParker error => ${e.toString()}'), stack); } return json; @@ -121,8 +124,10 @@ class Xml2Json { final parkerTransformer = _Xml2JsonParkerWithAttrs(); try { json = parkerTransformer.transform(_result, array: array); - } on Exception catch (e) { - throw Xml2JsonException('toParkerWithAttrs error => ${e.toString()}'); + } on Exception catch (e, stack) { + Error.throwWithStackTrace( + Xml2JsonException('toParkerWithAttrs error => ${e.toString()}'), + stack); } return json; @@ -138,8 +143,9 @@ class Xml2Json { final gDataTransformer = _Xml2JsonGData(); try { json = gDataTransformer.transform(_result); - } on Exception catch (e) { - throw Xml2JsonException('toGData error => ${e.toString()}'); + } on Exception catch (e, stack) { + Error.throwWithStackTrace( + Xml2JsonException('toGData error => ${e.toString()}'), stack); } return json; diff --git a/lib/src/xml2json_badgerfish.dart b/lib/src/xml2json_badgerfish.dart index 8b7538e..f1d0d0c 100644 --- a/lib/src/xml2json_badgerfish.dart +++ b/lib/src/xml2json_badgerfish.dart @@ -12,13 +12,27 @@ part of '../xml2json.dart'; class _Xml2JsonBadgerfish { /// Badgerfish transformer function. + final bool useLocalNameForNodes; final String _marker = '"\$"'; final String _xmlnsPrefix = '"@xmlns"'; final String _cdata = '"__cdata"'; - final bool useLocalNameForNodes; _Xml2JsonBadgerfish(this.useLocalNameForNodes); + /// Transformer function + String transform(XmlDocument? xmlNode) { + Map json; + try { + json = _transform(xmlNode); + } on Exception catch (e, stack) { + Error.throwWithStackTrace( + Xml2JsonException( + 'Badgerfish internal transform error => ${e.toString()}'), + stack); + } + return json.toString(); + } + Map _transform(XmlDocument? node) { final json = {}; @@ -98,16 +112,4 @@ class _Xml2JsonBadgerfish { process(node, json, {}); return json; } - - /// Transformer function - String transform(XmlDocument? xmlNode) { - Map json; - try { - json = _transform(xmlNode); - } on Exception catch (e) { - throw Xml2JsonException( - 'Badgerfish internal transform error => ${e.toString()}'); - } - return json.toString(); - } } diff --git a/lib/src/xml2json_exception.dart b/lib/src/xml2json_exception.dart index 0ee2149..65559cc 100644 --- a/lib/src/xml2json_exception.dart +++ b/lib/src/xml2json_exception.dart @@ -13,11 +13,11 @@ part of '../xml2json.dart'; /// This exception is thrown when Xml2Json has an internal error, /// such as an invalid parameter being passed to a function. class Xml2JsonException implements Exception { + final String _message; + /// Xml2Json exception Xml2JsonException([this._message = 'No Message Supplied']); - final String _message; - @override String toString() => 'Xml2JsonException: message = $_message'; } diff --git a/lib/src/xml2json_gdata.dart b/lib/src/xml2json_gdata.dart index 1189ed7..a6fe5e0 100644 --- a/lib/src/xml2json_gdata.dart +++ b/lib/src/xml2json_gdata.dart @@ -20,8 +20,21 @@ class _Xml2JsonGData { final String _xmlnsPrefix = '"xmlns"'; final String _cdata = '"__cdata"'; - /// GData transformer function. + /// Transformer function + String transform(XmlDocument? xmlNode) { + Map json; + try { + json = _transform(xmlNode); + } on Exception catch (e, stack) { + Error.throwWithStackTrace( + Xml2JsonException( + 'GData internal transform error => ${e.toString()}'), + stack); + } + return json.toString(); + } + // GData transformer function. Map _transform(XmlDocument? node) { final json = {}; @@ -116,16 +129,4 @@ class _Xml2JsonGData { process(node, json, {}); return json; } - - /// Transformer function - String transform(XmlDocument? xmlNode) { - Map json; - try { - json = _transform(xmlNode); - } on Exception catch (e) { - throw Xml2JsonException( - 'GData internal transform error => ${e.toString()}'); - } - return json.toString(); - } } diff --git a/lib/src/xml2json_open_rally.dart b/lib/src/xml2json_open_rally.dart index eb48a70..86c3922 100644 --- a/lib/src/xml2json_open_rally.dart +++ b/lib/src/xml2json_open_rally.dart @@ -8,7 +8,23 @@ part of '../xml2json.dart'; /// OpenRally transform class class _Xml2JsonOpenRally { - /// + /// Transformer function + String transform( + XmlDocument? xmlNode, { + String attributePrefix = '', + }) { + Map json; + try { + json = _recursiveParse(xmlNode, attributePrefix: attributePrefix); + } on Exception catch (e, stack) { + Error.throwWithStackTrace( + Xml2JsonException( + 'OpenRally internal transform error => ${e.toString()}'), + stack); + } + return json.toString(); + } + String _toJsonString(dynamic value, {String? prefix}) { value = _Xml2JsonUtils.escapeTextForJson(value); return '"${prefix ?? ''}$value"'; @@ -79,19 +95,4 @@ class _Xml2JsonOpenRally { return true; } } - - /// Transformer function - String transform( - XmlDocument? xmlNode, { - String attributePrefix = '', - }) { - Map json; - try { - json = _recursiveParse(xmlNode, attributePrefix: attributePrefix); - } on Exception catch (e) { - throw Xml2JsonException( - 'OpenRally internal transform error => ${e.toString()}'); - } - return json.toString(); - } } diff --git a/lib/src/xml2json_parker.dart b/lib/src/xml2json_parker.dart index 1476a07..36a3d3d 100644 --- a/lib/src/xml2json_parker.dart +++ b/lib/src/xml2json_parker.dart @@ -9,7 +9,22 @@ part of '../xml2json.dart'; /// Parker transform class class _Xml2JsonParker { - /// Parker transformer function. + /// Transformer function + String transform(XmlDocument? xmlNode) { + Map? json; + try { + json = _transform(xmlNode, {}); + } on Exception catch (e, stack) { + Error.throwWithStackTrace( + Xml2JsonException( + 'Parker internal transform error => ${e.toString()}'), + stack); + } + + return json.toString(); + } + + // Parker transformer function. Map? _transform(dynamic node, dynamic objin) { Map? obj = objin; if (node is XmlElement) { @@ -18,7 +33,7 @@ class _Xml2JsonParker { return null; } if (node.children.isNotEmpty) { - if (node.children[0] is XmlText || node.children[0] is XmlCDATA) { + if (node.children.first is XmlText || node.children.first is XmlCDATA) { _parseXmlTextNode(node, obj, nodeName); } else if (obj[nodeName] is Map) { var jsonCopy = json.decode(json.encode(obj[nodeName])); @@ -64,17 +79,4 @@ class _Xml2JsonParker { obj[nodeName] = nodeData; } } - - /// Transformer function - String transform(XmlDocument? xmlNode) { - Map? json; - try { - json = _transform(xmlNode, {}); - } on Exception catch (e) { - throw Xml2JsonException( - 'Parker internal transform error => ${e.toString()}'); - } - - return json.toString(); - } } diff --git a/lib/src/xml2json_parker_with_attrs.dart b/lib/src/xml2json_parker_with_attrs.dart index bae72a0..b51ef6e 100644 --- a/lib/src/xml2json_parker_with_attrs.dart +++ b/lib/src/xml2json_parker_with_attrs.dart @@ -11,7 +11,22 @@ part of '../xml2json.dart'; /// ParkerWithAttrs transform class. /// Used as an alternative to Parker if the node element contains attributes. class _Xml2JsonParkerWithAttrs { - /// Parker transformer function. + /// Transformer function + String transform(XmlDocument? xmlNode, {List? array}) { + Map? json; + try { + json = _transform(xmlNode, {}, array: array); + } on Exception catch (e, stack) { + Error.throwWithStackTrace( + Xml2JsonException( + 'Parker with attrs internal transform error => ${e.toString()}'), + stack); + } + + return json.toString(); + } + + // Parker transformer function. Map? _transform(dynamic node, dynamic objin, {List? array}) { Map? obj = objin; @@ -29,7 +44,7 @@ class _Xml2JsonParkerWithAttrs { final dummyNode = XmlText(''); node.children.add(dummyNode); } - if (node.children[0] is XmlText || node.children[0] is XmlCDATA) { + if (node.children.first is XmlText || node.children.first is XmlCDATA) { _parseXmlTextNode(node, obj, nodeName, array: array); } else if (obj[nodeName] is Map) { var jsonCopy = json.decode(json.encode(obj[nodeName])); @@ -71,7 +86,7 @@ class _Xml2JsonParkerWithAttrs { return obj; } - /// Analyze the attribute value in the node + // Analyze the attribute value in the node void _parseAttrs(dynamic node, dynamic obj) { node.attributes.forEach((attr) { obj!['"_${_Xml2JsonUtils.escapeTextForJson(attr.name.qualified)}"'] = @@ -79,7 +94,7 @@ class _Xml2JsonParkerWithAttrs { }); } - /// Parse XmlText node + // Parse XmlText node void _parseXmlTextNode(dynamic node, dynamic obj, dynamic nodeName, {List? array}) { final sanitisedNodeData = @@ -116,17 +131,4 @@ class _Xml2JsonParkerWithAttrs { obj[nodeName] = [jsonCopy]; } } - - /// Transformer function - String transform(XmlDocument? xmlNode, {List? array}) { - Map? json; - try { - json = _transform(xmlNode, {}, array: array); - } on Exception catch (e) { - throw Xml2JsonException( - 'Parker with attrs internal transform error => ${e.toString()}'); - } - - return json.toString(); - } } diff --git a/lib/src/xml2json_utils.dart b/lib/src/xml2json_utils.dart index 0973dc9..d4ed680 100644 --- a/lib/src/xml2json_utils.dart +++ b/lib/src/xml2json_utils.dart @@ -12,6 +12,8 @@ part of '../xml2json.dart'; /// General utilities class _Xml2JsonUtils { + static const mapValueLength = 2; + /// Escape any control characters and quotes for JSON encoding static String escapeTextForJson(String text) { var text1 = text.replaceAll('\n', '\\\\n'); @@ -32,8 +34,8 @@ class _Xml2JsonUtils { final properties = text1.split(' '); for (final dynamic element in properties) { final List elementList = element.split('='); - if (elementList.length == 2) { - nodeMap[elementList[0]] = elementList[1]; + if (elementList.length == mapValueLength) { + nodeMap[elementList.first] = elementList[1]; } } From 027c3c946dc1eba92c0cafc540b612151cea4b52 Mon Sep 17 00:00:00 2001 From: Steve Hamblett Date: Wed, 2 Apr 2025 10:29:51 +0100 Subject: [PATCH 3/4] DCM fixes - format --- lib/src/xml2json.dart | 21 ++- lib/src/xml2json_badgerfish.dart | 8 +- lib/src/xml2json_gdata.dart | 11 +- lib/src/xml2json_open_rally.dart | 24 ++-- lib/src/xml2json_parker.dart | 11 +- lib/src/xml2json_parker_with_attrs.dart | 28 ++-- pubspec.yaml | 2 +- test/issue16_test.dart | 12 +- test/issue23_test.dart | 116 ++++++++-------- test/issue30_test.dart | 3 +- test/issue33_test.dart | 12 +- test/issue36_test.dart | 6 +- test/issue48_test.dart | 9 +- test/issue62_test.dart | 15 +- test/issues/issue28.dart | 7 +- test/issues/issue29.dart | 7 +- test/issues/issue41.dart | 1 - test/xml2json_test.dart | 173 ++++++++++++++++-------- test/xml2json_test_strings.dart | 15 +- 19 files changed, 295 insertions(+), 186 deletions(-) diff --git a/lib/src/xml2json.dart b/lib/src/xml2json.dart index 10b1e44..7f0c640 100644 --- a/lib/src/xml2json.dart +++ b/lib/src/xml2json.dart @@ -72,7 +72,9 @@ class Xml2Json { json = badgerfishTransformer.transform(_result); } on Exception catch (e, stack) { Error.throwWithStackTrace( - Xml2JsonException('toBadgerfish error => ${e.toString()}'), stack); + Xml2JsonException('toBadgerfish error => ${e.toString()}'), + stack, + ); } return json; @@ -90,7 +92,9 @@ class Xml2Json { json = openRallyTransformer.transform(_result); } on Exception catch (e, stack) { Error.throwWithStackTrace( - Xml2JsonException('toOpenRally error => ${e.toString()}'), stack); + Xml2JsonException('toOpenRally error => ${e.toString()}'), + stack, + ); } return json; @@ -108,7 +112,9 @@ class Xml2Json { json = parkerTransformer.transform(_result); } on Exception catch (e, stack) { Error.throwWithStackTrace( - Xml2JsonException('toParker error => ${e.toString()}'), stack); + Xml2JsonException('toParker error => ${e.toString()}'), + stack, + ); } return json; @@ -126,8 +132,9 @@ class Xml2Json { json = parkerTransformer.transform(_result, array: array); } on Exception catch (e, stack) { Error.throwWithStackTrace( - Xml2JsonException('toParkerWithAttrs error => ${e.toString()}'), - stack); + Xml2JsonException('toParkerWithAttrs error => ${e.toString()}'), + stack, + ); } return json; @@ -145,7 +152,9 @@ class Xml2Json { json = gDataTransformer.transform(_result); } on Exception catch (e, stack) { Error.throwWithStackTrace( - Xml2JsonException('toGData error => ${e.toString()}'), stack); + Xml2JsonException('toGData error => ${e.toString()}'), + stack, + ); } return json; diff --git a/lib/src/xml2json_badgerfish.dart b/lib/src/xml2json_badgerfish.dart index f1d0d0c..5a9c8b9 100644 --- a/lib/src/xml2json_badgerfish.dart +++ b/lib/src/xml2json_badgerfish.dart @@ -26,9 +26,11 @@ class _Xml2JsonBadgerfish { json = _transform(xmlNode); } on Exception catch (e, stack) { Error.throwWithStackTrace( - Xml2JsonException( - 'Badgerfish internal transform error => ${e.toString()}'), - stack); + Xml2JsonException( + 'Badgerfish internal transform error => ${e.toString()}', + ), + stack, + ); } return json.toString(); } diff --git a/lib/src/xml2json_gdata.dart b/lib/src/xml2json_gdata.dart index a6fe5e0..5ee4911 100644 --- a/lib/src/xml2json_gdata.dart +++ b/lib/src/xml2json_gdata.dart @@ -27,9 +27,9 @@ class _Xml2JsonGData { json = _transform(xmlNode); } on Exception catch (e, stack) { Error.throwWithStackTrace( - Xml2JsonException( - 'GData internal transform error => ${e.toString()}'), - stack); + Xml2JsonException('GData internal transform error => ${e.toString()}'), + stack, + ); } return json.toString(); } @@ -118,8 +118,9 @@ class _Xml2JsonGData { final nodeMap = _Xml2JsonUtils.mapProcessingNode(processingString); for (final i in nodeMap.keys) { final index = '"$i"'; - final sanitisedNodeData = - _Xml2JsonUtils.escapeTextForJson(nodeMap[i]!); + final sanitisedNodeData = _Xml2JsonUtils.escapeTextForJson( + nodeMap[i]!, + ); final nodeData = '"$sanitisedNodeData"'; obj[index] = nodeData; } diff --git a/lib/src/xml2json_open_rally.dart b/lib/src/xml2json_open_rally.dart index 86c3922..8d9d6f4 100644 --- a/lib/src/xml2json_open_rally.dart +++ b/lib/src/xml2json_open_rally.dart @@ -9,18 +9,17 @@ part of '../xml2json.dart'; /// OpenRally transform class class _Xml2JsonOpenRally { /// Transformer function - String transform( - XmlDocument? xmlNode, { - String attributePrefix = '', - }) { + String transform(XmlDocument? xmlNode, {String attributePrefix = ''}) { Map json; try { json = _recursiveParse(xmlNode, attributePrefix: attributePrefix); } on Exception catch (e, stack) { Error.throwWithStackTrace( - Xml2JsonException( - 'OpenRally internal transform error => ${e.toString()}'), - stack); + Xml2JsonException( + 'OpenRally internal transform error => ${e.toString()}', + ), + stack, + ); } return json.toString(); } @@ -31,10 +30,7 @@ class _Xml2JsonOpenRally { } /// - dynamic _recursiveParse( - dynamic node, { - String attributePrefix = '', - }) { + dynamic _recursiveParse(dynamic node, {String attributePrefix = ''}) { if (node is XmlDocument) { Map document = {}; for (var child in node.children) { @@ -51,8 +47,10 @@ class _Xml2JsonOpenRally { for (var attribute in node.attributes) { children.addAll({ - _toJsonString(attribute.name.local, prefix: attributePrefix): - _toJsonString(attribute.value) + _toJsonString( + attribute.name.local, + prefix: attributePrefix, + ): _toJsonString(attribute.value), }); } diff --git a/lib/src/xml2json_parker.dart b/lib/src/xml2json_parker.dart index 36a3d3d..b82ca86 100644 --- a/lib/src/xml2json_parker.dart +++ b/lib/src/xml2json_parker.dart @@ -16,9 +16,9 @@ class _Xml2JsonParker { json = _transform(xmlNode, {}); } on Exception catch (e, stack) { Error.throwWithStackTrace( - Xml2JsonException( - 'Parker internal transform error => ${e.toString()}'), - stack); + Xml2JsonException('Parker internal transform error => ${e.toString()}'), + stack, + ); } return json.toString(); @@ -65,8 +65,9 @@ class _Xml2JsonParker { /// 解析XmlText节点 void _parseXmlTextNode(dynamic node, dynamic obj, dynamic nodeName) { - final sanitisedNodeData = - _Xml2JsonUtils.escapeTextForJson(node.children[0].text); + final sanitisedNodeData = _Xml2JsonUtils.escapeTextForJson( + node.children[0].text, + ); var nodeData = '"$sanitisedNodeData"'; if (nodeData.isEmpty) { nodeData = ''; diff --git a/lib/src/xml2json_parker_with_attrs.dart b/lib/src/xml2json_parker_with_attrs.dart index b51ef6e..ca5f38c 100644 --- a/lib/src/xml2json_parker_with_attrs.dart +++ b/lib/src/xml2json_parker_with_attrs.dart @@ -18,17 +18,22 @@ class _Xml2JsonParkerWithAttrs { json = _transform(xmlNode, {}, array: array); } on Exception catch (e, stack) { Error.throwWithStackTrace( - Xml2JsonException( - 'Parker with attrs internal transform error => ${e.toString()}'), - stack); + Xml2JsonException( + 'Parker with attrs internal transform error => ${e.toString()}', + ), + stack, + ); } return json.toString(); } // Parker transformer function. - Map? _transform(dynamic node, dynamic objin, - {List? array}) { + Map? _transform( + dynamic node, + dynamic objin, { + List? array, + }) { Map? obj = objin; if (node is XmlElement) { final nodeName = '"${node.name.qualified}"'; @@ -95,10 +100,15 @@ class _Xml2JsonParkerWithAttrs { } // Parse XmlText node - void _parseXmlTextNode(dynamic node, dynamic obj, dynamic nodeName, - {List? array}) { - final sanitisedNodeData = - _Xml2JsonUtils.escapeTextForJson(node.children[0].text); + void _parseXmlTextNode( + dynamic node, + dynamic obj, + dynamic nodeName, { + List? array, + }) { + final sanitisedNodeData = _Xml2JsonUtils.escapeTextForJson( + node.children[0].text, + ); var nodeData = '"$sanitisedNodeData"'; if (nodeData.isEmpty) { nodeData = ''; diff --git a/pubspec.yaml b/pubspec.yaml index c07a220..6cba6b8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -8,7 +8,7 @@ funding: - https://www.darticulate.com/#funding environment: - sdk: '>=3.0.0 <4.0.0' + sdk: '>=3.7.0 <4.0.0' dependencies: xml: '^6.5.0' diff --git a/test/issue16_test.dart b/test/issue16_test.dart index 614cf40..68e9cde 100644 --- a/test/issue16_test.dart +++ b/test/issue16_test.dart @@ -20,11 +20,15 @@ void main() { myTransformer.parse(issue16); final bf = myTransformer.toBadgerfish(); expect(bf, isNotNull); - expect(bf.contains('""C:Program Files (x86)MSBuild14.0BinMSBuild.exe""'), - isFalse); + expect( + bf.contains('""C:Program Files (x86)MSBuild14.0BinMSBuild.exe""'), + isFalse, + ); final gd = myTransformer.toGData(); expect(gd, isNotNull); - expect(gd.contains('""C:Program Files (x86)MSBuild14.0BinMSBuild.exe""'), - isFalse); + expect( + gd.contains('""C:Program Files (x86)MSBuild14.0BinMSBuild.exe""'), + isFalse, + ); }); } diff --git a/test/issue23_test.dart b/test/issue23_test.dart index 4a39879..e4bbcc0 100644 --- a/test/issue23_test.dart +++ b/test/issue23_test.dart @@ -7,67 +7,73 @@ import 'package:xml2json/xml2json.dart'; void main() { test( - 'xml2json escapes " in the json output when used in an xml attribute - Badgerfish', - () { - final xml = ''; - print(xml); - final actual = (Xml2Json()..parse(xml)).toBadgerfish(); - print(actual); - final expected = '{"element": {"@att": " \\"test\\" "}}'; - expect(actual, equals(expected)); - final decoded = json.decode(actual); - expect(decoded['element']['@att'], ' "test" '); - }); + 'xml2json escapes " in the json output when used in an xml attribute - Badgerfish', + () { + final xml = ''; + print(xml); + final actual = (Xml2Json()..parse(xml)).toBadgerfish(); + print(actual); + final expected = '{"element": {"@att": " \\"test\\" "}}'; + expect(actual, equals(expected)); + final decoded = json.decode(actual); + expect(decoded['element']['@att'], ' "test" '); + }, + ); test( - 'xml2json escapes " in the json output when used in an xml attribute - GData', - () { - final xml = ''; - print(xml); - final actual = (Xml2Json()..parse(xml)).toGData(); - print(actual); - final expected = '{"element": {"att": " \\"test\\" "}}'; - expect(actual, equals(expected)); - final decoded = json.decode(actual); - expect(decoded['element']['att'], ' "test" '); - }); + 'xml2json escapes " in the json output when used in an xml attribute - GData', + () { + final xml = ''; + print(xml); + final actual = (Xml2Json()..parse(xml)).toGData(); + print(actual); + final expected = '{"element": {"att": " \\"test\\" "}}'; + expect(actual, equals(expected)); + final decoded = json.decode(actual); + expect(decoded['element']['att'], ' "test" '); + }, + ); test( - 'xml2json escapes " in the json output when used in an xml attribute - OpenRally', - () { - final xml = ''; - print(xml); - final actual = (Xml2Json()..parse(xml)).toOpenRally(); - print(actual); - final expected = '{"element": {"att": " \\"test\\" "}}'; - expect(actual, equals(expected)); - final decoded = json.decode(actual); - expect(decoded['element']['att'], ' "test" '); - }); + 'xml2json escapes " in the json output when used in an xml attribute - OpenRally', + () { + final xml = ''; + print(xml); + final actual = (Xml2Json()..parse(xml)).toOpenRally(); + print(actual); + final expected = '{"element": {"att": " \\"test\\" "}}'; + expect(actual, equals(expected)); + final decoded = json.decode(actual); + expect(decoded['element']['att'], ' "test" '); + }, + ); test( - 'xml2json escapes " in the json output when used in an xml attribute - Parker', - () { - final xml = ''; - print(xml); - final actual = (Xml2Json()..parse(xml)).toParker(); - print(actual); - final expected = '{"element": " \\"test\\" "}'; - expect(actual, equals(expected)); - final decoded = json.decode(actual); - expect(decoded['element'], ' "test" '); - }, skip: true); + 'xml2json escapes " in the json output when used in an xml attribute - Parker', + () { + final xml = ''; + print(xml); + final actual = (Xml2Json()..parse(xml)).toParker(); + print(actual); + final expected = '{"element": " \\"test\\" "}'; + expect(actual, equals(expected)); + final decoded = json.decode(actual); + expect(decoded['element'], ' "test" '); + }, + skip: true, + ); test( - 'xml2json escapes " in the json output when used in an xml attribute - Parker with Attrs', - () { - final xml = ''; - print(xml); - final actual = (Xml2Json()..parse(xml)).toParkerWithAttrs(); - print(actual); - final expected = '{"element": {"_att": " \\"test\\" ", "value": ""}}'; - expect(actual, equals(expected)); - final decoded = json.decode(actual); - expect(decoded['element'], {'_att': ' "test" ', 'value': ''}); - }); + 'xml2json escapes " in the json output when used in an xml attribute - Parker with Attrs', + () { + final xml = ''; + print(xml); + final actual = (Xml2Json()..parse(xml)).toParkerWithAttrs(); + print(actual); + final expected = '{"element": {"_att": " \\"test\\" ", "value": ""}}'; + expect(actual, equals(expected)); + final decoded = json.decode(actual); + expect(decoded['element'], {'_att': ' "test" ', 'value': ''}); + }, + ); } diff --git a/test/issue30_test.dart b/test/issue30_test.dart index d4694db..3ffd4be 100644 --- a/test/issue30_test.dart +++ b/test/issue30_test.dart @@ -25,7 +25,8 @@ void main() { test('Real decode', () async { final uri = Uri.parse( - 'https://safebooru.org/index.php?page=dapi&s=post&q=index&tags=%20m/'); + 'https://safebooru.org/index.php?page=dapi&s=post&q=index&tags=%20m/', + ); final httpClient = HttpClient(); final req = await httpClient.getUrl(uri); final rsp = await req.close(); diff --git a/test/issue33_test.dart b/test/issue33_test.dart index 04506d9..f678714 100644 --- a/test/issue33_test.dart +++ b/test/issue33_test.dart @@ -23,8 +23,10 @@ void main() { // 如果多个相同的节点中只有String类型的value,将所有的value解析到同一个数组中 var jsonResponse = xmlParser.toParkerWithAttrs(); print(jsonResponse); - expect(jsonResponse, - '{"root": {"result": "ok", "items": {"_parent": "111", "item": [{"_id": "10", "value": "Android"}, {"_id": "11", "value": "iOS"}, {"_id": "12", "value": "Flutter"}]}}}'); + expect( + jsonResponse, + '{"root": {"result": "ok", "items": {"_parent": "111", "item": [{"_id": "10", "value": "Android"}, {"_id": "11", "value": "iOS"}, {"_id": "12", "value": "Flutter"}]}}}', + ); var decodedOk = true; try { json.decode(jsonResponse); @@ -50,8 +52,10 @@ void main() { xmlParser.parse(input); var jsonResponse = xmlParser.toParkerWithAttrs(); print(jsonResponse); - expect(jsonResponse, - '{"root": {"result": "ok", "items": {"item": ["Android", "iOS", "Flutter"]}}}'); + expect( + jsonResponse, + '{"root": {"result": "ok", "items": {"item": ["Android", "iOS", "Flutter"]}}}', + ); var decodedOk = true; try { json.decode(jsonResponse); diff --git a/test/issue36_test.dart b/test/issue36_test.dart index ede4018..020b689 100644 --- a/test/issue36_test.dart +++ b/test/issue36_test.dart @@ -27,8 +27,10 @@ void main() { xmlParser.parse(input); var jsonResponse = xmlParser.toParkerWithAttrs(array: ['item']); print(jsonResponse); - expect(jsonResponse, - '{"root": {"result": "ok", "items": {"item": ["Flutter"]}}}'); + expect( + jsonResponse, + '{"root": {"result": "ok", "items": {"item": ["Flutter"]}}}', + ); var decodedOk = true; try { json.decode(jsonResponse); diff --git a/test/issue48_test.dart b/test/issue48_test.dart index 04f8f38..5b1cf77 100644 --- a/test/issue48_test.dart +++ b/test/issue48_test.dart @@ -6,7 +6,8 @@ import 'package:xml2json/xml2json.dart'; void main() { test('Incorrect transform', () { - const input = "" + const input = + "" " " " 1" " 1000029214" @@ -23,7 +24,9 @@ void main() { xmlParser.parse(input); var jsonResponse = xmlParser.toParkerWithAttrs(); print(jsonResponse); - expect(jsonResponse, - '{"SubItems": {"Item": {"Value": ["1", "2", "", "3"], "LinkTo": ["1000029214", "1000029214", "1000029214", "1000029214"]}}}'); + expect( + jsonResponse, + '{"SubItems": {"Item": {"Value": ["1", "2", "", "3"], "LinkTo": ["1000029214", "1000029214", "1000029214", "1000029214"]}}}', + ); }); } diff --git a/test/issue62_test.dart b/test/issue62_test.dart index 3bb32f1..d04f441 100644 --- a/test/issue62_test.dart +++ b/test/issue62_test.dart @@ -5,7 +5,8 @@ import 'package:test/test.dart'; import 'package:xml2json/xml2json.dart'; void main() { - const input = "" + const input = + "" "" "Introduction" ": Transdermal drug delivery has several clinical benefits over conventional routes of drug administration. To open the transdermal route for a wider range of drugs, including macromolecules, numerous physical and chemical techniques to overcome the natural low skin permeability have been developed." @@ -20,15 +21,19 @@ void main() { final xmlParser = Xml2Json(); xmlParser.parse(input); var jsonResponse = xmlParser.toBadgerfish(); - expect(jsonResponse, - '{"Abstract": {"AbstractText": {"b": [{"\$": "Introduction"}, {"\$": "Areas covered"}, {"\$": "Expert opinion"}], "\$": ": Transdermal drug delivery has several clinical benefits over conventional routes of drug administration. To open the transdermal route for a wider range of drugs, including macromolecules, numerous physical and chemical techniques to overcome the natural low skin permeability have been developed."": This review focuses on permeation enhancers (penetration enhancers, percutaneous absorption promoters or accelerants), which are chemicals that increase drug flux through the skin barrier. First, skin components, drug permeation pathways, and drug properties are introduced. Next, we discuss properties of enhancers, their various classifications, structure-activity relationships, mechanisms of action, reversibility and toxicity, biodegradable enhancers, and synergistic enhancer combinations."": Overcoming the remarkable skin barrier properties in an efficient, temporary and safe manner remains a challenge. High permeation-enhancing potency has long been perceived to be associated with toxicity and irritation potential of such compounds, which has limited their further development. In addition, the complexity of enhancer interactions with skin, formulation and drug, along with their vast chemical diversity hampered understanding of their mechanisms of action. The recent development in the field revealed highly potent yet safe enhancers or enhancer combinations, which suggest that enhancer-aided transdermal drug delivery has yet to reach its full potential."}}}'); + expect( + jsonResponse, + '{"Abstract": {"AbstractText": {"b": [{"\$": "Introduction"}, {"\$": "Areas covered"}, {"\$": "Expert opinion"}], "\$": ": Transdermal drug delivery has several clinical benefits over conventional routes of drug administration. To open the transdermal route for a wider range of drugs, including macromolecules, numerous physical and chemical techniques to overcome the natural low skin permeability have been developed."": This review focuses on permeation enhancers (penetration enhancers, percutaneous absorption promoters or accelerants), which are chemicals that increase drug flux through the skin barrier. First, skin components, drug permeation pathways, and drug properties are introduced. Next, we discuss properties of enhancers, their various classifications, structure-activity relationships, mechanisms of action, reversibility and toxicity, biodegradable enhancers, and synergistic enhancer combinations."": Overcoming the remarkable skin barrier properties in an efficient, temporary and safe manner remains a challenge. High permeation-enhancing potency has long been perceived to be associated with toxicity and irritation potential of such compounds, which has limited their further development. In addition, the complexity of enhancer interactions with skin, formulation and drug, along with their vast chemical diversity hampered understanding of their mechanisms of action. The recent development in the field revealed highly potent yet safe enhancers or enhancer combinations, which suggest that enhancer-aided transdermal drug delivery has yet to reach its full potential."}}}', + ); }); test('Fixed GData', () { final xmlParser = Xml2Json(); xmlParser.parse(input); var jsonResponse = xmlParser.toGData(); - expect(jsonResponse, - '{"Abstract": {"AbstractText": {"b": [{"\$t": "Introduction"}, {"\$t": "Areas covered"}, {"\$t": "Expert opinion"}], "\$t": ": Transdermal drug delivery has several clinical benefits over conventional routes of drug administration. To open the transdermal route for a wider range of drugs, including macromolecules, numerous physical and chemical techniques to overcome the natural low skin permeability have been developed."": This review focuses on permeation enhancers (penetration enhancers, percutaneous absorption promoters or accelerants), which are chemicals that increase drug flux through the skin barrier. First, skin components, drug permeation pathways, and drug properties are introduced. Next, we discuss properties of enhancers, their various classifications, structure-activity relationships, mechanisms of action, reversibility and toxicity, biodegradable enhancers, and synergistic enhancer combinations."": Overcoming the remarkable skin barrier properties in an efficient, temporary and safe manner remains a challenge. High permeation-enhancing potency has long been perceived to be associated with toxicity and irritation potential of such compounds, which has limited their further development. In addition, the complexity of enhancer interactions with skin, formulation and drug, along with their vast chemical diversity hampered understanding of their mechanisms of action. The recent development in the field revealed highly potent yet safe enhancers or enhancer combinations, which suggest that enhancer-aided transdermal drug delivery has yet to reach its full potential."}}}'); + expect( + jsonResponse, + '{"Abstract": {"AbstractText": {"b": [{"\$t": "Introduction"}, {"\$t": "Areas covered"}, {"\$t": "Expert opinion"}], "\$t": ": Transdermal drug delivery has several clinical benefits over conventional routes of drug administration. To open the transdermal route for a wider range of drugs, including macromolecules, numerous physical and chemical techniques to overcome the natural low skin permeability have been developed."": This review focuses on permeation enhancers (penetration enhancers, percutaneous absorption promoters or accelerants), which are chemicals that increase drug flux through the skin barrier. First, skin components, drug permeation pathways, and drug properties are introduced. Next, we discuss properties of enhancers, their various classifications, structure-activity relationships, mechanisms of action, reversibility and toxicity, biodegradable enhancers, and synergistic enhancer combinations."": Overcoming the remarkable skin barrier properties in an efficient, temporary and safe manner remains a challenge. High permeation-enhancing potency has long been perceived to be associated with toxicity and irritation potential of such compounds, which has limited their further development. In addition, the complexity of enhancer interactions with skin, formulation and drug, along with their vast chemical diversity hampered understanding of their mechanisms of action. The recent development in the field revealed highly potent yet safe enhancers or enhancer combinations, which suggest that enhancer-aided transdermal drug delivery has yet to reach its full potential."}}}', + ); }); } diff --git a/test/issues/issue28.dart b/test/issues/issue28.dart index 062d0b0..44dccae 100644 --- a/test/issues/issue28.dart +++ b/test/issues/issue28.dart @@ -1,6 +1,5 @@ // @dart=2.10.5 @TestOn('vm') - import 'dart:convert'; import 'package:test/test.dart'; import 'package:xml2json/xml2json.dart'; @@ -24,8 +23,10 @@ void main() { xmlParser.parse(input); var jsonResponse = xmlParser.toParker(); print(jsonResponse); - expect(jsonResponse, - '{"soapenv:Envelope": {"soapenv:Body": {"ns1:GetCommentsResponse": {"status": "true", "message": "Succeed", "comments": {"feedback": "it\'s a bug, it\'s not a bug"}}}}}'); + expect( + jsonResponse, + '{"soapenv:Envelope": {"soapenv:Body": {"ns1:GetCommentsResponse": {"status": "true", "message": "Succeed", "comments": {"feedback": "it\'s a bug, it\'s not a bug"}}}}}', + ); var decodedOk = true; try { final decoded = json.decode(jsonResponse); diff --git a/test/issues/issue29.dart b/test/issues/issue29.dart index 0164154..f6ef800 100644 --- a/test/issues/issue29.dart +++ b/test/issues/issue29.dart @@ -1,6 +1,5 @@ // @dart=2.10.5 @TestOn('vm') - import 'dart:convert'; import 'package:test/test.dart'; import 'package:xml2json/xml2json.dart'; @@ -24,8 +23,10 @@ void main() { xmlParser.parse(input); var jsonResponse = xmlParser.toParker(); print(jsonResponse); - expect(jsonResponse, - '{"soapenv:Envelope": {"soapenv:Body": {"ns1:GetCommentsResponse": {"status": "true", "message": "Succeed", "comments": {"feedback": "04/04/2019\$\$##+|=\\\\€"}}}}}'); + expect( + jsonResponse, + '{"soapenv:Envelope": {"soapenv:Body": {"ns1:GetCommentsResponse": {"status": "true", "message": "Succeed", "comments": {"feedback": "04/04/2019\$\$##+|=\\\\€"}}}}}', + ); var decodedOk = true; try { final decoded = json.decode(jsonResponse); diff --git a/test/issues/issue41.dart b/test/issues/issue41.dart index 6b4009e..e13cbe5 100644 --- a/test/issues/issue41.dart +++ b/test/issues/issue41.dart @@ -7,7 +7,6 @@ */ // @dart=2.12.0 @TestOn('vm') - import 'dart:convert'; import 'package:test/test.dart'; import 'package:xml2json/xml2json.dart'; diff --git a/test/xml2json_test.dart b/test/xml2json_test.dart index 3501d0e..a67513b 100644 --- a/test/xml2json_test.dart +++ b/test/xml2json_test.dart @@ -18,39 +18,59 @@ void main() { test('Badgerfish', () { expect( - myTransformer.toBadgerfish, - throwsA(predicate((dynamic e) => - e is Xml2JsonException && - e.toString() == - 'Xml2JsonException: message = toBadgerfish - ' - 'no parse result'))); + myTransformer.toBadgerfish, + throwsA( + predicate( + (dynamic e) => + e is Xml2JsonException && + e.toString() == + 'Xml2JsonException: message = toBadgerfish - ' + 'no parse result', + ), + ), + ); }); test('Parker', () { expect( - myTransformer.toParker, - throwsA(predicate((dynamic e) => - e is Xml2JsonException && - e.toString() == - 'Xml2JsonException: message = toParker - no parse result'))); + myTransformer.toParker, + throwsA( + predicate( + (dynamic e) => + e is Xml2JsonException && + e.toString() == + 'Xml2JsonException: message = toParker - no parse result', + ), + ), + ); }); test('GData', () { expect( - myTransformer.toGData, - throwsA(predicate((dynamic e) => - e is Xml2JsonException && - e.toString() == - 'Xml2JsonException: message = toGData - no parse result'))); + myTransformer.toGData, + throwsA( + predicate( + (dynamic e) => + e is Xml2JsonException && + e.toString() == + 'Xml2JsonException: message = toGData - no parse result', + ), + ), + ); }); test('OpenRally', () { expect( - myTransformer.toOpenRally, - throwsA(predicate((dynamic e) => - e is Xml2JsonException && - e.toString() == - 'Xml2JsonException: message = toOpenRally - no parse result'))); + myTransformer.toOpenRally, + throwsA( + predicate( + (dynamic e) => + e is Xml2JsonException && + e.toString() == + 'Xml2JsonException: message = toOpenRally - no parse result', + ), + ), + ); }); }); @@ -61,11 +81,16 @@ void main() { test('Invalid XML', () { expect( - () => myTransformer.parse(rubbishXmlString), - throwsA(predicate((dynamic e) => - e is Xml2JsonException && - e.toString() == - 'Xml2JsonException: message = parse error - invalid XML'))); + () => myTransformer.parse(rubbishXmlString), + throwsA( + predicate( + (dynamic e) => + e is Xml2JsonException && + e.toString() == + 'Xml2JsonException: message = parse error - invalid XML', + ), + ), + ); }); test('Valid XML', () { @@ -94,11 +119,15 @@ void main() { test('Transform Simple test string', () { final res = myTransformer.toBadgerfish(); - expect(res.replaceAll(' ', ''), - equals(badgerfishSimpleJsonCheckString.replaceAll(' ', ''))); + expect( + res.replaceAll(' ', ''), + equals(badgerfishSimpleJsonCheckString.replaceAll(' ', '')), + ); /* Re parse just to check */ - expect(json.encode(res), - isNot(throwsA(const TypeMatcher()))); + expect( + json.encode(res), + isNot(throwsA(const TypeMatcher())), + ); }); test('Parse Complex test string', () { @@ -109,11 +138,15 @@ void main() { test('Transform Complex test string', () { final res = myTransformer.toBadgerfish(); - expect(res.replaceAll(' ', ''), - equals(badgerfishComplexJsonCheckString.replaceAll(' ', ''))); + expect( + res.replaceAll(' ', ''), + equals(badgerfishComplexJsonCheckString.replaceAll(' ', '')), + ); /* Re parse just to check */ - expect(json.encode(res), - isNot(throwsA(const TypeMatcher()))); + expect( + json.encode(res), + isNot(throwsA(const TypeMatcher())), + ); }); test('Transform Local Node Name test string', () { @@ -121,11 +154,15 @@ void main() { final dynamic result = myTransformer.xmlParserResult; expect(result, isNot(isNull)); final res = myTransformer.toBadgerfish(useLocalNameForNodes: true); - expect(res.replaceAll(' ', ''), - equals(badgerfishLocalNodeCheckString.replaceAll(' ', ''))); + expect( + res.replaceAll(' ', ''), + equals(badgerfishLocalNodeCheckString.replaceAll(' ', '')), + ); /* Re parse just to check */ - expect(json.encode(res), - isNot(throwsA(const TypeMatcher()))); + expect( + json.encode(res), + isNot(throwsA(const TypeMatcher())), + ); }); }); @@ -142,11 +179,15 @@ void main() { test('Transform Simple test string', () { final res = myTransformer.toParker(); - expect(res.replaceAll(' ', ''), - equals(parkerSimpleJsonCheckString.replaceAll(' ', ''))); + expect( + res.replaceAll(' ', ''), + equals(parkerSimpleJsonCheckString.replaceAll(' ', '')), + ); /* Re parse just to check */ - expect(json.encode(res), - isNot(throwsA(const TypeMatcher()))); + expect( + json.encode(res), + isNot(throwsA(const TypeMatcher())), + ); }); test('Parse Complex test string', () { @@ -157,11 +198,15 @@ void main() { test('Transform Complex test string', () { final res = myTransformer.toParker(); - expect(res.replaceAll(' ', ''), - equals(parkerComplexJsonCheckString.replaceAll(' ', ''))); + expect( + res.replaceAll(' ', ''), + equals(parkerComplexJsonCheckString.replaceAll(' ', '')), + ); /* Re parse just to check */ - expect(json.encode(res), - isNot(throwsA(const TypeMatcher()))); + expect( + json.encode(res), + isNot(throwsA(const TypeMatcher())), + ); }); }); @@ -178,11 +223,15 @@ void main() { test('Transform Simple test string', () { final res = myTransformer.toGData(); - expect(res.replaceAll(' ', ''), - equals(gDataSimpleJsonCheckString.replaceAll(' ', ''))); + expect( + res.replaceAll(' ', ''), + equals(gDataSimpleJsonCheckString.replaceAll(' ', '')), + ); /* Re parse just to check */ - expect(json.encode(res), - isNot(throwsA(const TypeMatcher()))); + expect( + json.encode(res), + isNot(throwsA(const TypeMatcher())), + ); }); test('Parse Complex test string', () { @@ -193,11 +242,15 @@ void main() { test('Transform Complex test string', () { final res = myTransformer.toGData(); - expect(res.replaceAll(' ', ''), - equals(gDataComplexJsonCheckString.replaceAll(' ', ''))); + expect( + res.replaceAll(' ', ''), + equals(gDataComplexJsonCheckString.replaceAll(' ', '')), + ); /* Re parse just to check */ - expect(json.encode(res), - isNot(throwsA(const TypeMatcher()))); + expect( + json.encode(res), + isNot(throwsA(const TypeMatcher())), + ); }); }); @@ -214,11 +267,15 @@ void main() { test('Transform test string', () { final res = myTransformer.toOpenRally(); - expect(res.replaceAll(' ', '').replaceAll('\n', ''), - equals(openRallyStringJson.replaceAll(' ', '').replaceAll('\n', ''))); + expect( + res.replaceAll(' ', '').replaceAll('\n', ''), + equals(openRallyStringJson.replaceAll(' ', '').replaceAll('\n', '')), + ); /* Re parse just to check */ - expect(json.encode(res), - isNot(throwsA(const TypeMatcher()))); + expect( + json.encode(res), + isNot(throwsA(const TypeMatcher())), + ); }); }); } diff --git a/test/xml2json_test_strings.dart b/test/xml2json_test_strings.dart index e822277..702a2e5 100644 --- a/test/xml2json_test_strings.dart +++ b/test/xml2json_test_strings.dart @@ -84,7 +84,8 @@ String badgerfishSimpleJsonCheckString = '{ "contacts": { "contact": { "@id": "1", "name": { "\$": "John Doe" }, "phone": { "\$": "123-\\"456\\"-7890" }, "address": { "street": { "\$": "123 JFKStreet" }, "city": { "\$": "Any Town" }, "state": { "\$": "Any State" }, "zipCode": { "\$": "12345" } } } } }'; /* Badgerfish complex test check string from http://wiki.open311.org/index.php?title=JSON_and_XML_Conversion*/ -String badgerfishComplexJsonCheckString = '{' +String badgerfishComplexJsonCheckString = + '{' '"reports": {' '"@xmlns": [{' '"\$": "http://www.w3.org/2005/Atom"},' @@ -253,7 +254,8 @@ String parkerSimpleJsonCheckString = '{"contacts": {"contact": {"name": "John Doe", "phone": "123-\\"456\\"-7890", "address": {"street": "123 JFKStreet", "city": "Any Town", "state": "Any State", "zipCode": "12345"}}}}'; /* Parker complex test check string from http://wiki.open311.org/index.php?title=JSON_and_XML_Conversion*/ -String parkerComplexJsonCheckString = '{' +String parkerComplexJsonCheckString = + '{' '"reports": "This is cdata with \\"quotes\\"", "entry":' '[{' '"id":"tag:open311.sfgov.org,2010-04-15:/dev/V1/reports/637619.xml",' @@ -319,7 +321,8 @@ String gDataSimpleJsonCheckString = '{"contacts": { "contact": { "id": "1", "name": { "\$t": "John Doe" }, "phone": { "\$t": "123-\\"456\\"-7890" }, "address": { "street": { "\$t": "123 JFKStreet" }, "city": { "\$t": "Any Town" }, "state": { "\$t": "Any State" }, "zipCode": { "\$t": "12345" } } } } }'; /* GData complex XML test string from https://developers.google.com/gdata/docs/json?csw=1 */ -String gDatacomplexXmlTestString = '' @@ -375,7 +378,8 @@ String gDatacomplexXmlTestString = ''; /* GData complex test check string from */ -String gDataComplexJsonCheckString = '{' +String gDataComplexJsonCheckString = + '{' '"feed": {' '"xmlns": "http://www.w3.org/2005/Atom",' '"xmlns\$openSearch": "http://a9.com/-/spec/opensearchrss/1.0/",' @@ -463,7 +467,8 @@ String gDataComplexJsonCheckString = '{' '}' '}' '}'; -String issue16 = '' +String issue16 = + '' '' '' '' From 0834f0445f2775e0f803f5f7c18c27c4977d3262 Mon Sep 17 00:00:00 2001 From: Steve Hamblett Date: Wed, 2 Apr 2025 11:05:13 +0100 Subject: [PATCH 4/4] DCM fixes - changelog --- CHANGELOG.md | 71 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 42 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 896840c..0c6b030 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,84 +1,95 @@ ## 6.2.6 -Issue 71 +- [Issue 71](https://github.com/shamblett/xml2json/issues/71) ## 6.2.5 -Issue 67 +- [Issue 67](https://github.com/shamblett/xml2json/issues/67) ## 6.2.4 -Update to issue 23 +Update to Issue 23 +- [Issue 23](https://github.com/shamblett/xml2json/issues/23) ## 6.2.3 Added topics and screenshot ## 6.2.2 -Issue 64 +- [Issue 64](https://github.com/shamblett/xml2json/issues/64) ## 6.2.1 -Issue 62 +- [Issue 62](https://github.com/shamblett/xml2json/issues/62) ## 6.2.0 -Issue 23 - OpenRally update +- [Issue 23](https://github.com/shamblett/xml2json/issues/23) - OpenRally update ## 6.1.0 -Issue 58 +- [Issue 58](https://github.com/shamblett/xml2json/issues/58) ## 6.0.0 -Issue 60 - Dart 3 +- [Issue 60](https://github.com/shamblett/xml2json/issues/60) - Dart 3 ## 5.3.6 -Issue 52 +- [Issue 52](https://github.com/shamblett/xml2json/issues/52) ## 5.3.5 -Issue 51 +- [Issue 51](https://github.com/shamblett/xml2json/issues/51) ## 5.3.4 -Issue 48 +- [Issue 48](https://github.com/shamblett/xml2json/issues/48) ## 5.3.3 PR 46 and issue 47, remove Travis +- [PR 46](https://github.com/shamblett/xml2json/pull/46) +- [Issue 47](https://github.com/shamblett/xml2json/issues/47) ## 5.3.2 PR's 44 and 45, add SBOM +- [PR 44](https://github.com/shamblett/xml2json/pull/44) +- [PR 45](https://github.com/shamblett/xml2json/pull/45) ## 5.3.1 -Issue 41 +- [Issue 41](https://github.com/shamblett/xml2json/issues/41) ## 5.3.0 -Issue 36 +- [Issue 36](https://github.com/shamblett/xml2json/issues/36) ## 5.2.0 -Issue 33, addition of Parker with attributes transformer. +- [Issue 33](https://github.com/shamblett/xml2json/issues/33), addition of Parker with attributes transformer. ## 5.1.0 Merge pull request #32 from faithoflifedev/master +- [PR 32](https://github.com/shamblett/xml2json/pull/32) + Badgerfish transform now supports the option to use local name for nodes. ## 5.0.0 Issues 27(NNBD), 28, 29 and 30 +- [Issue 27](https://github.com/shamblett/xml2json/issues/27) +- [Issue 28](https://github.com/shamblett/xml2json/issues/28) +- [Issue 29](https://github.com/shamblett/xml2json/issues/29) +- [Issue 30](https://github.com/shamblett/xml2json/issues/30) ## 5.0.0-nullsafety.0 Null safety first update ## 4.4.0 -Issue 23 +- [Issue 23](https://github.com/shamblett/xml2json/issues/23) ## 4.3.0 -Issue 21 +- [Issue 21](https://github.com/shamblett/xml2json/issues/21) ## 4.2.1 -Issue 20 +- [Issue 20](https://github.com/shamblett/xml2json/issues/20) ## 4.2.0 -Issue 16 +- [Issue 16](https://github.com/shamblett/xml2json/issues/16) ## 4.1.1 Linter updates ## 4.1.0 -Pull request 18, add CDATA node parsing for Parker +- [Pull request 18](https://github.com/shamblett/xml2json/pull/18), add CDATA node parsing for Parker ## 4.0.0 -Issue 17, License is now MIT, small tidy ups +- [Issue 17](https://github.com/shamblett/xml2json/issues/17), License is now MIT, small tidy ups ## 3.0.3 Update testing, new linter rules @@ -87,16 +98,16 @@ Update testing, new linter rules Update testing, run browser tests on Travis ## 3.0.1 -Issue 15, relax sdk constraints for flutter +- [Issue 15](https://github.com/shamblett/xml2json/issues/15), relax sdk constraints for flutter ## 3.0.0 -Issue 14, update to Dart 2 +- [Issue 14](https://github.com/shamblett/xml2json/issues/14), update to Dart 2 ## 2.0.14 -Issue 12, update to latest XML package +- [Issue 12](https://github.com/shamblett/xml2json/issues/12), update to latest XML package ## 2.0.13 -Issue 11, exception message bug +- [Issue 11](https://github.com/shamblett/xml2json/issues/11), exception message bug ## 2.0.12 Remove dev infinity constraint on the Dart SDK for Flutter @@ -109,16 +120,16 @@ Rename the analysis options file ## 2.0.9 -Issue 9, SDK version constraint update, general +- [Issue 9](https://github.com/shamblett/xml2json/issues/9), SDK version constraint update, general pre Dart 2.0 spruce up ## 2.0.8 -Issue 8, correctly escape CDATA strings for JSON +- [Issue 8](https://github.com/shamblett/xml2json/issues/8), correctly escape CDATA strings for JSON ## 2.0.7 -Issue 7, CDATA nodes now translated for Badgerfish +- [Issue 7](https://github.com/shamblett/xml2json/issues/7), CDATA nodes now translated for Badgerfish and GData. ## 2.0.6 @@ -126,6 +137,8 @@ and GData. Use the new XML Package, update to latest Petit Parser see issue 5 in github. +- [Issue 5](https://github.com/shamblett/xml2json/issues/5) + Remove Drone IO integration, now done by pub. ## 2.0.5 @@ -134,7 +147,7 @@ Integrate with Dart's Drone IO testing ## 2.0.4 -Browser is now a dev dependancy +Browser is now a dev dependency ## 2.0.3 @@ -154,6 +167,6 @@ Updates for Dart 1.0 release ## 1.1.0 -* Fix the runtime type name change intoroduced in Dart r28101 +* Fix the runtime type name change introduced in Dart r28101 * Generate API documents * Package formatting updates