Ejemplo n.º 1
0
        //============================================================
        //	PUBLIC METHODS
        //============================================================
        #region Load(XPathNavigator source)
        /// <summary>
        /// Loads this <see cref="XmlRpcStructureValue"/> using the supplied <see cref="XPathNavigator"/>.
        /// </summary>
        /// <param name="source">The <see cref="XPathNavigator"/> to extract information from.</param>
        /// <returns><b>true</b> if the <see cref="XmlRpcStructureValue"/> was initialized using the supplied <paramref name="source"/>, otherwise <b>false</b>.</returns>
        /// <remarks>
        ///     <para>This method expects the supplied <paramref name="source"/> to be positioned on the XML element that represents a <see cref="XmlRpcStructureValue"/>.</para>
        /// </remarks>
        /// <exception cref="ArgumentNullException">The <paramref name="source"/> is a null reference (Nothing in Visual Basic).</exception>
        public bool Load(XPathNavigator source)
        {
            //------------------------------------------------------------
            //	Local members
            //------------------------------------------------------------
            bool wasLoaded = false;

            //------------------------------------------------------------
            //	Validate parameter
            //------------------------------------------------------------
            Guard.ArgumentNotNull(source, "source");

            //------------------------------------------------------------
            //	Attempt to extract structure information
            //------------------------------------------------------------
            if (source.HasChildren)
            {
                XPathNodeIterator memberIterator = source.Select("struct/member");
                if (memberIterator != null && memberIterator.Count > 0)
                {
                    while (memberIterator.MoveNext())
                    {
                        XmlRpcStructureMember member = new XmlRpcStructureMember();
                        if (member.Load(memberIterator.Current))
                        {
                            this.Members.Add(member);
                            wasLoaded = true;
                        }
                    }
                }
            }

            return(wasLoaded);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Loads this <see cref="XmlRpcStructureValue"/> using the supplied <see cref="XPathNavigator"/>.
        /// </summary>
        /// <param name="source">The <see cref="XPathNavigator"/> to extract information from.</param>
        /// <returns><b>true</b> if the <see cref="XmlRpcStructureValue"/> was initialized using the supplied <paramref name="source"/>, otherwise <b>false</b>.</returns>
        /// <remarks>
        ///     <para>This method expects the supplied <paramref name="source"/> to be positioned on the XML element that represents a <see cref="XmlRpcStructureValue"/>.</para>
        /// </remarks>
        /// <exception cref="ArgumentNullException">The <paramref name="source"/> is a null reference (Nothing in Visual Basic).</exception>
        public bool Load(XPathNavigator source)
        {
            bool wasLoaded = false;

            Guard.ArgumentNotNull(source, "source");

            if (source.HasChildren)
            {
                XPathNodeIterator memberIterator = source.Select("struct/member");
                if (memberIterator != null && memberIterator.Count > 0)
                {
                    while (memberIterator.MoveNext())
                    {
                        XmlRpcStructureMember member = new XmlRpcStructureMember();
                        if (member.Load(memberIterator.Current))
                        {
                            this.Members.Add(member);
                            wasLoaded = true;
                        }
                    }
                }
            }

            return(wasLoaded);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="XmlRpcStructureValue"/> class using the supplied <see cref="XPathNodeIterator"/>.
        /// </summary>
        /// <param name="iterator">A <see cref="XPathNodeIterator"/> that represents the <i>member</i> nodes for the structured list.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="iterator"/> is a null reference (Nothing in Visual Basic).</exception>
        public XmlRpcStructureValue(XPathNodeIterator iterator)
        {
            Guard.ArgumentNotNull(iterator, "iterator");

            if (iterator.Count > 0)
            {
                while (iterator.MoveNext())
                {
                    XmlRpcStructureMember member = new XmlRpcStructureMember();
                    if (member.Load(iterator.Current))
                    {
                        this.Members.Add(member);
                    }
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="XmlRpcStructureValue"/> class using the supplied <see cref="XPathNodeIterator"/>.
        /// </summary>
        /// <param name="iterator">A <see cref="XPathNodeIterator"/> that represents the <i>member</i> nodes for the structured list.</param>
        /// <exception cref="ArgumentNullException">The <paramref name="iterator"/> is a null reference (Nothing in Visual Basic).</exception>
        public XmlRpcStructureValue(XPathNodeIterator iterator)
        {
            //------------------------------------------------------------
            //	Validate parameter
            //------------------------------------------------------------
            Guard.ArgumentNotNull(iterator, "iterator");

            //------------------------------------------------------------
            //	Parse iterator nodes to load collection
            //------------------------------------------------------------
            if (iterator.Count > 0)
            {
                while (iterator.MoveNext())
                {
                    XmlRpcStructureMember member = new XmlRpcStructureMember();
                    if (member.Load(iterator.Current))
                    {
                        this.Members.Add(member);
                    }
                }
            }
        }