You need to select the nodes where the
enum has the code, and then back up one level and go down in the
english node and select it's value.
The
XPath for that would look something like this;
/root/row/enum[.=\"code"]/parent::row/english
Or in code;
class Program {
static IEnumerable<string> GetEnglishString(XPathNavigator navigator, string code) {
var path = String.Format("/root/row/enum[.=\"{0}\"]/parent::row/english", code);
return navigator.Select(path).Cast<XPathNavigator>().Select(n => n.Value);
}
static void Main(string[] args) {
var document = new XmlDocument();
document.Load(@"C:\Temp\XmlExample\Eng_Language.xml");
var navigator = document.CreateNavigator();
var notWorking = GetEnglishString(navigator, "SerialPort_NotWork").FirstOrDefault();
var demoMode = GetEnglishString(navigator, "SoftwareRun_DemoMode").FirstOrDefault();
Console.WriteLine("notWorking={0}", notWorking);
Console.WriteLine("demoMode={0}", demoMode);
}
}
Hope this helps,
Fredrik