Philip Grooms

Philip Grooms

  • 2.1k
  • 38
  • 641

Check if XML has a node

Jan 28 2023 11:12 PM

When reading an XML file into C# i can parse everything as long as the XML file has a Node/Element named Note. I need a way to read xml to see if Note exists and then do something else do something else. Any help would be greatly appreciated.

I have tried different code however they all have given me errors:

XmlNodeList elements = elmRoot.GetElementsByTagName("Node");
Boolean found = false;
foreach(XmlElement element in elements)
    if(element.Name  == Note)
        found = true;


Answers (3)