コード例 #1
0
        /// <summary>
        /// Parse a XML element and create the array instance from it.
        /// </summary>
        /// <param name="element">Element to parse.</param>
        public XmlRpcArray(XElement element) : base(element)
        {
            var arrayValues = element.Elements(XmlRpcElementNames.Data)
                              .First()
                              .Elements(XmlRpcElementNames.Value);
            List <XmlRpcBaseType> values = new();

            foreach (XElement valueElement in arrayValues)
            {
                XmlRpcBaseType value = XmlRpcTypes.ElementToInstance(valueElement.Elements().First());
                values.Add(value);
            }

            Values = values.ToArray();
        }
コード例 #2
0
        public XmlRpcStruct(XElement element) : base(element)
        {
            Fields = new Struct();
            var members = element.Elements(XmlRpcElementNames.Member);

            foreach (XElement member in members)
            {
                string   name         = member.Elements(XmlRpcElementNames.Name).First().Value;
                XElement valueElement = member.Elements(XmlRpcElementNames.Value)
                                        .First()
                                        .Elements()
                                        .First();

                XmlRpcBaseType value = XmlRpcTypes.ElementToInstance(valueElement);

                Fields.Add(name, value);
            }
        }