formatXMLString method

String formatXMLString(
  1. String xml
)

Implementation

String formatXMLString(String xml) {
  XmlDocument formattedDOC = XmlDocument.parse(xml);
  String formattedXML = formattedDOC.toXmlString(pretty: true, preserveWhitespace: (_) => true);
  XmlDocument formattedDOC2 = XmlDocument.parse(formattedXML);
  String formattedXML2 = formattedDOC2.toXmlString(pretty: true);
  formattedXML2 = formattedXML2.replaceAll(artemisWhiteSpace, " ").replaceAll(artemisWhiteEnter, "\n");
  return formattedXML2;
}