AGS.Types.SerializeUtils.GetElementString C# (CSharp) Метод

GetElementString() публичный статический Метод

Wrapper function for SelectSingleNode that throws an exception mentioning the node name if it is not found. Returns the node text if successful.
public static GetElementString ( XmlNode node, string elementName ) : string
node System.Xml.XmlNode
elementName string
Результат string
        public static string GetElementString(XmlNode node, string elementName)
        {
            XmlNode foundNode = node.SelectSingleNode(elementName);
            if (foundNode == null)
            {
                throw new InvalidDataException("Missing XML element: " + elementName);
            }
            return foundNode.InnerText;
        }

Usage Example

Пример #1
0
Файл: View.cs Проект: stee01/ags
 public View(XmlNode node)
 {
     ID   = Convert.ToInt32(SerializeUtils.GetElementString(node, "ID"));
     Name = SerializeUtils.GetElementString(node, "Name");
     foreach (XmlNode loopNode in SerializeUtils.GetChildNodes(node, "Loops"))
     {
         _loops.Add(new ViewLoop(loopNode));
     }
 }
All Usage Examples Of AGS.Types.SerializeUtils::GetElementString