diff options
Diffstat (limited to 'src/wix/WixToolset.Core.TestPackage/XmlNodeExtensions.cs')
-rw-r--r-- | src/wix/WixToolset.Core.TestPackage/XmlNodeExtensions.cs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/wix/WixToolset.Core.TestPackage/XmlNodeExtensions.cs b/src/wix/WixToolset.Core.TestPackage/XmlNodeExtensions.cs index b269fb25..2f4c1aa3 100644 --- a/src/wix/WixToolset.Core.TestPackage/XmlNodeExtensions.cs +++ b/src/wix/WixToolset.Core.TestPackage/XmlNodeExtensions.cs | |||
@@ -4,6 +4,7 @@ namespace WixToolset.Core.TestPackage | |||
4 | { | 4 | { |
5 | using System.Collections.Generic; | 5 | using System.Collections.Generic; |
6 | using System.IO; | 6 | using System.IO; |
7 | using System.Linq; | ||
7 | using System.Text.RegularExpressions; | 8 | using System.Text.RegularExpressions; |
8 | using System.Xml; | 9 | using System.Xml; |
9 | 10 | ||
@@ -61,6 +62,19 @@ namespace WixToolset.Core.TestPackage | |||
61 | return Regex.Replace(formattedXml, " xmlns(:[^=]+)?='[^']*'", ""); | 62 | return Regex.Replace(formattedXml, " xmlns(:[^=]+)?='[^']*'", ""); |
62 | } | 63 | } |
63 | 64 | ||
65 | /// <summary> | ||
66 | /// Returns the XML for each node using single quotes and stripping all namespaces. | ||
67 | /// </summary> | ||
68 | /// <param name="nodeList"></param> | ||
69 | /// <param name="ignoredAttributesByElementName">Attributes for which the value should be set to '*'.</param> | ||
70 | /// <returns></returns> | ||
71 | public static string[] GetTestXmlLines(this XmlNodeList nodeList, Dictionary<string, List<string>> ignoredAttributesByElementName = null) | ||
72 | { | ||
73 | return nodeList.Cast<XmlNode>() | ||
74 | .Select(x => x.GetTestXml(ignoredAttributesByElementName)) | ||
75 | .ToArray(); | ||
76 | } | ||
77 | |||
64 | private static void HandleIgnoredAttributes(XmlNode node, Dictionary<string, List<string>> ignoredAttributesByElementName) | 78 | private static void HandleIgnoredAttributes(XmlNode node, Dictionary<string, List<string>> ignoredAttributesByElementName) |
65 | { | 79 | { |
66 | if (node.Attributes != null && ignoredAttributesByElementName.TryGetValue(node.LocalName, out var ignoredAttributes)) | 80 | if (node.Attributes != null && ignoredAttributesByElementName.TryGetValue(node.LocalName, out var ignoredAttributes)) |