Skip to content

Commit

Permalink
Issue62 (#63)
Browse files Browse the repository at this point in the history
* Issue 62

* Issue 62
  • Loading branch information
shamblett authored Nov 6, 2023
1 parent 4eab074 commit 765e52d
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/src/xml2json_badgerfish.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ class _Xml2JsonBadgerfish {
} else if (obj[_marker] is Map<dynamic, dynamic>) {
obj[_marker] = <dynamic>[obj[_marker], nodeData];
} else {
obj[_marker] = nodeData;
if ((obj as Map).containsKey(_marker)) {
obj[_marker] = obj[_marker] + nodeData;
} else {
obj[_marker] = nodeData;
}
}
} else if (node is XmlElement) {
/* Element node processing */
Expand Down
6 changes: 5 additions & 1 deletion lib/src/xml2json_gdata.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ class _Xml2JsonGData {
} else if (obj[_marker] is Map) {
obj[_marker] = <dynamic>[obj[_marker], nodeData];
} else {
obj[_marker] = nodeData;
if ((obj as Map).containsKey(_marker)) {
obj[_marker] = obj[_marker] + nodeData;
} else {
obj[_marker] = nodeData;
}
}
} else if (node is XmlElement) {
/* Element node processing */
Expand Down
33 changes: 33 additions & 0 deletions test/issue62_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
@TestOn('vm')

import 'package:test/test.dart';
import 'package:xml2json/xml2json.dart';

void main() {
const input = "<Abstract>"
"<AbstractText>"
"<b>Introduction</b>"
": 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."
"<b>Areas covered</b>"
": 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."
"<b>Expert opinion</b>"
": 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."
"</AbstractText>"
"</Abstract>";

test('Fixed Badgerfish', () {
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."}}}');
});

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."}}}');
});
}

0 comments on commit 765e52d

Please sign in to comment.