Index: DamEngine/trunk/src/Deltares.DamEngine.TestHelpers/XmlAdapter.cs =================================================================== diff -u -r4540 -r5397 --- DamEngine/trunk/src/Deltares.DamEngine.TestHelpers/XmlAdapter.cs (.../XmlAdapter.cs) (revision 4540) +++ DamEngine/trunk/src/Deltares.DamEngine.TestHelpers/XmlAdapter.cs (.../XmlAdapter.cs) (revision 5397) @@ -19,6 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System.Linq; using System.Text.RegularExpressions; namespace Deltares.DamEngine.TestHelpers; @@ -43,4 +44,21 @@ result = Regex.Replace(input, searchString, replacement, RegexOptions.IgnorePatternWhitespace); return result; } + + public static string SelectLocations(string input, string[] locationNames) + { + string result = input; + const string searchString = @""; + MatchCollection locationBlocks = Regex.Matches(result, searchString, RegexOptions.Singleline); + for (int i = locationBlocks.Count - 1; i > -1; i--) + { + bool isMatch = locationNames.Any(locationName => Regex.IsMatch(locationBlocks[i].Value, "Name=" + "\"" + locationName + "\"")); + if (!isMatch) + { + result = result.Remove(locationBlocks[i].Index, locationBlocks[i].Length); + } + } + return result; + } + } \ No newline at end of file