<(E-Mail Removed)> wrote:
> 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;
Could you post a short but complete program which demonstrates the
problem?
See
http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.
--
Jon Skeet - <(E-Mail Removed)>
http://www.pobox.com/~skeet Blog:
http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too