After Deserialize XML in XDoc (type XDocument) I do For Each on XDoc.Elements(“MyNode1”).Elements(“MyNode2”).Elements(“MyNode3”)
But no MyNode3 element in xml-file and I get error “Object reference not set to an instance of an object” in For Each.
I parsing different xml-files and I don’t know if this element is in the file or not.
How to check there is an element in XDoc or not?
In the directory, where I am parsing the xml, xml-files can be of different formats. This is normal.
And if the robot took a different format for analysis, where there are no my MyNode1,2,3 etc elements, it did not break when called XDoc.Elements(“MyNode1”).Elements(“MyNode2”).Elements(“MyNode3”)