/// <summary> /// Find a child with a given name in an element. /// </summary> /// <param name="element"></param> /// <param name="name"></param> /// <returns></returns> public static XmlElement FindChild(this XmlElement element, string name) { foreach (var child in element.ChildElements()) if (child.Name == name) return child; return null; }
/// <summary> /// Find a terminal child with a given name in an element. /// </summary> /// <param name="element"></param> /// <param name="name"></param> /// <returns></returns> public static XmlElement FindTerminalChild(this XmlElement element, string name) { foreach (var child in element.ChildElements()) { if (child.Name == name && child.IsTerminal()) return child; } return null; }