AGS.Types.SerializeUtils.GetChildNodes C# (CSharp) Méthode

GetChildNodes() public static méthode

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
Résultat 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

Exemple #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