private static XmlAttribute GetMpcAttribute(XmlDocument document) { const string node = "/s12:Envelope/s12:Header/eb:Messaging/eb:SignalMessage/eb:PullRequest"; XmlAttributeCollection attributes = document.SelectEbmsNode(node).Attributes; return(attributes?.Cast <XmlAttribute>().FirstOrDefault(x => x.Name == "mpc")); }
GetAttributes(XmlNode n) { XmlAttributeCollection coll = n.Attributes; if (coll != null) { return(coll.Cast <XmlAttribute>() .ToDictionary <XmlAttribute, XmlQualifiedName, string>(GetQName, a => a.Value)); } return(new Dictionary <XmlQualifiedName, string>()); }
private static void Compare(XmlAttributeCollection expected, XmlAttributeCollection actual) { if (expected == null && actual == null) { return; } Assert.IsNotNull(expected); Assert.IsNotNull(actual); Dictionary <string, XmlAttribute> _ad = expected.Cast <XmlAttribute>().ToDictionary <XmlAttribute, string>(x => x.Name); foreach (XmlAttribute _atr in actual) { Assert.IsTrue(_ad.ContainsKey(_atr.Name), _atr.InnerText); Assert.AreEqual <string>(_ad[_atr.Name].InnerText, _atr.InnerText); } }
private static IEnumerable <XmlAttribute> Sort(XmlAttributeCollection attributes) { foreach (XmlAttribute att in attributes) { if (att.Name.Equals("Name", StringComparison.OrdinalIgnoreCase)) { yield return(att); break; } } foreach (var att in attributes.Cast <XmlAttribute>().Where(x => !x.Name.Equals("Name", StringComparison.OrdinalIgnoreCase)).OrderBy(x => x.Name)) { yield return(att); } }
public static bool Exists(this XmlAttributeCollection attributes, string attributeName) { return(attributes.Cast <XmlAttribute>().Any(x => x.Name == attributeName)); }
public static List <XmlAttribute> ToList(this XmlAttributeCollection collection) { //var nn = new List <XmlAttribute>(); return(collection?.Cast <XmlAttribute>().ToList() ?? new List <XmlAttribute>()); }
public static bool HasAttribute(this XmlAttributeCollection attributes, string attributeName) => attributes.Cast <XmlAttribute>().Any(x => x.Name == attributeName);
public static bool Contains(this XmlAttributeCollection attrs, string name) { return(attrs.Cast <XmlAttribute>().Any(a => a.Name == name)); }
public key(string name, string value, level lvl, XmlAttributeCollection attrs) : base(name, lvl) { _value = value; _attrs = attrs.Cast <XmlAttribute>().ToDictionary(x => x.Name, x => x.Value); }