Getting NullReferenceException: Object reference not set to an instance of an object when using Linq reading an xml file.

Hi, I am getting this error even though I am getting value .This is my code:

public class Assessments : MonoBehaviour {
	public string dataName;

	void Start () {
		XElement xDoc = XElement.Load(Application.dataPath + "/XmlDocs/"+dataName+".xml");
		IEnumerable<XElement> AllData = xDoc.Elements();

		// Read the entire XML
		foreach (var mentalApplication in AllData)
		{
			string a = mentalApplication.Element("ScoutUser").Value;
			print(a);
		}
	}
}

Thanks.

It’s likely that one of the children of the root element does not have “ScoutUser” child. Could you paste full error message and the test XML file, so that it’s possible to investigate the real reason of the exception?