You don't need a schema to read a file. The schema is only used to validate the file (to check integrity). But this step is optional.
To read the XML file. I suggest to use Linq-to-XML.
const string mpNamespace = "bs.TestParameters";
XDocument xDocument = XDocument.Load("C:/Path to the file.xml");
List<string> finalValues = (from dateNode in xDocument.Descendants(XName.Get("Date", mpNamespace)) // Gets all Date nodes in the document
from finalValueNode in dateNode.Descendants(XName.Get("FinalValue", mpNamespace)) // Gets all FinalValue nodes in the Date nodes
select finalValueNode.Value // Gets the value of each FinalValue node
).ToList();
Update
To return the Date
and the FinalValue
you can use anonymous types:
const string mpNamespace = "bs.TestParameters";
const string xcNamespace = "XmlTest";
XDocument xDocument = XDocument.Load("C:/Path to the file.xml");
var finalValues = (from dateNode in xDocument.Descendants(XName.Get("Date", mpNamespace)) // Gets all Date nodes in the document
from finalValueNode in dateNode.Descendants(XName.Get("FinalValue", mpNamespace)) // Gets all FinalValue nodes in the Date nodes
select new // Creates an instance of an anonymous type with Date and FinalValue
{
Date = dateNode.Attribute(XName.Get("Value", xcNamespace)).Value,
FinalValue = finalValueNode.Value // Gets the value of each FinalValue node
}
).ToList();