/// <summary>
        /// Reads a node containing no attributes and all of its children, where each child is of the same type.
        /// </summary>
        /// <param name="node">The <see cref="XmlNode"/> to read.</param>
        /// <param name="nodeName">The name of the collection node.</param>
        /// <param name="childNodeName">The name of the children nodes.</param>
        /// <param name="readItem">A delegate pointing to the method that reads the individual collection items.</param>
        /// <returns>true if the node was read correctly; otherwise, false.</returns>
        protected bool ReadCollectionNode(XmlNode node, string nodeName, string childNodeName, ReadCollectionItem readItem)
        {
            bool successful = true;

            // Make sure we're reading the expected node.
            if (!this.VerifyNode(node, nodeName))
            {
                Tracer.Fail("Getting to this point indicates a bug.");
                return false;
            }

            // Read all of the children.
            foreach (XmlNode childNode in node.ChildNodes)
            {
                if (childNode.Name == childNodeName)
                {
                    if (!readItem(childNode))
                    {
                        successful = false;
                        break;
                    }
                }
            }

            return successful;
        }
Example #2
0
        /// <summary>
        /// Reads a node containing no attributes and all of its children, where each child is of the same type.
        /// </summary>
        /// <param name="node">The <see cref="XmlNode"/> to read.</param>
        /// <param name="nodeName">The name of the collection node.</param>
        /// <param name="childNodeName">The name of the children nodes.</param>
        /// <param name="readItem">A delegate pointing to the method that reads the individual collection items.</param>
        /// <returns>true if the node was read correctly; otherwise, false.</returns>
        protected bool ReadCollectionNode(XmlNode node, string nodeName, string childNodeName, ReadCollectionItem readItem)
        {
            bool successful = true;

            // Make sure we're reading the expected node.
            if (!this.VerifyNode(node, nodeName))
            {
                Tracer.Fail("Getting to this point indicates a bug.");
                return(false);
            }

            // Read all of the children.
            foreach (XmlNode childNode in node.ChildNodes)
            {
                if (childNode.Name == childNodeName)
                {
                    if (!readItem(childNode))
                    {
                        successful = false;
                        break;
                    }
                }
            }

            return(successful);
        }