private static void ExtractOtherFeatures(XElement features, ISet<string> tags) { features.ShouldNotBe(null); tags.ShouldNotBe(null); var value = features.ValueOrDefault("otherFeatures"); if (string.IsNullOrWhiteSpace(value)) { return; } // Split the value up into comma delimeted parts. var parts = value.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries); foreach (var part in parts) { tags.Add(part.Trim()); } }
private static void ExtractFeatureWithTextValues(XElement document, string elementName, string[] validValues, ISet<string> tags, string delimeter = "-") { document.ShouldNotBe(null); elementName.ShouldNotBeNullOrEmpty(); validValues.ShouldNotBe(null); tags.ShouldNotBe(null); var type = document.ValueOrDefault(elementName, ("type")); if (string.IsNullOrWhiteSpace(type)) { return; } if (validValues.Contains(type, StringComparer.InvariantCultureIgnoreCase)) { tags.Add(string.Format("{0}{1}{2}", elementName, string.IsNullOrWhiteSpace(delimeter) ? string.Empty : delimeter, type)); } }