예제 #1
0
            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"));
            }
예제 #2
0
        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>());
        }
예제 #3
0
        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);
            }
        }
예제 #4
0
        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));
 }
예제 #6
0
 public static List <XmlAttribute> ToList(this XmlAttributeCollection collection)
 {
     //var nn = new List <XmlAttribute>();
     return(collection?.Cast <XmlAttribute>().ToList() ?? new List <XmlAttribute>());
 }
예제 #7
0
 public static bool HasAttribute(this XmlAttributeCollection attributes, string attributeName) =>
 attributes.Cast <XmlAttribute>().Any(x => x.Name == attributeName);
예제 #8
0
 public static bool Contains(this XmlAttributeCollection attrs, string name)
 {
     return(attrs.Cast <XmlAttribute>().Any(a => a.Name == name));
 }
예제 #9
0
 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);
 }