R
roto23
I am able to correctly XPath to the correct Node in the XML file,
however when I try to get the value of an attribute on that node, it
doenot work.
intX gets a value of 1 so I am sure the XPath query is correct but this
line retunrs an empty string...
strDBFactor = NodeIter.Current.GetAttribute("DeathBenefitFactor", "");
here is the complete code..
string strDBFactor;
int intX;
strXmlQuery = "Root/DataPoint[@Age='40' and @RateClass='P' and
@Sex='F']";
docNav = new XPathDocument(strXmlFileNameAndPath);
nav = docNav.CreateNavigator();
NodeIter = nav.Select(strXmlQuery);
intX = NodeIter.Count;
strDBFactor = NodeIter.Current.GetAttribute("DeathBenefitFactor", "");
return strDBFactor;
however when I try to get the value of an attribute on that node, it
doenot work.
intX gets a value of 1 so I am sure the XPath query is correct but this
line retunrs an empty string...
strDBFactor = NodeIter.Current.GetAttribute("DeathBenefitFactor", "");
here is the complete code..
string strDBFactor;
int intX;
strXmlQuery = "Root/DataPoint[@Age='40' and @RateClass='P' and
@Sex='F']";
docNav = new XPathDocument(strXmlFileNameAndPath);
nav = docNav.CreateNavigator();
NodeIter = nav.Select(strXmlQuery);
intX = NodeIter.Count;
strDBFactor = NodeIter.Current.GetAttribute("DeathBenefitFactor", "");
return strDBFactor;