Skip to content

Commit

Permalink
Minify xml by using XmlDocument.InnerXml
Browse files Browse the repository at this point in the history
  • Loading branch information
FreePhoenix888 committed Jul 10, 2022
1 parent b1ca26f commit 69bbe56
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,11 @@ public void Test(string initialXml)
var exportedXmlStream = new MemoryStream();
Export(documentLink, storage, exportedXmlStream);
var exportedXml = Encoding.UTF8.GetString(encodedXmlStream.ToArray());
var minimizedInitialXml = Regex.Replace(initialXml, "(\"(?:[^\"\\\\]|\\\\.)*\")|\\s+", "$1");
Assert.Equal(minimizedInitialXml, exportedXml);
// var minimizedInitialXml = Regex.Replace(initialXml, "(\"(?:[^\"\\\\]|\\\\.)*\")|\\s+", "$1");
var xmlDocument = new XmlDocument();
xmlDocument.LoadXml(exportedXml);
var minimizedInitialXml = xmlDocument.InnerXml;
Assert.Equal(exportedXml, minimizedInitialXml);
}
}
}

0 comments on commit 69bbe56

Please sign in to comment.