AGS.Types.SerializeUtils.GetChildNodes C# (CSharp) Method

GetChildNodes() public static method

Wrapper function for SelectSingleNode that throws an exception mentioning the node name if it is not found. Returns the node's children if successful.
public static GetChildNodes ( XmlNode parent, string elementName ) : XmlNodeList
parent System.Xml.XmlNode
elementName string
return System.Xml.XmlNodeList
        public static XmlNodeList GetChildNodes(XmlNode parent, string elementName)
        {
            XmlNode foundNode = parent.SelectSingleNode(elementName);
            if (foundNode == null)
            {
                throw new InvalidDataException("Missing XML element: " + elementName);
            }
            return foundNode.ChildNodes;
        }

Usage Example

Esempio n. 1
0
 public TextParser(XmlNode node)
 {
     foreach (XmlNode wordNode in SerializeUtils.GetChildNodes(node, "Words"))
     {
         _words.Add(new TextParserWord(wordNode));
     }
 }
All Usage Examples Of AGS.Types.SerializeUtils::GetChildNodes