2
Answers

How to get XML LastChild attribute value in silverlight

Raj Kumar

Raj Kumar

14y
14.6k
1
This is my xml..

<Users>  
  <User UserId="1" Email="[email protected]" Password="rajk" FirstName="raj" LastName="kumar" />
  <User UserId="2" Email="[email protected]" Password="1234" FirstName="raj" LastName="beniwal" />
  <User UserId="3" Email="[email protected]" Password="2222" FirstName="david" LastName="sann" />
</Users>

i wanna fetch UseId 3 on page...i tried this code but it's not working.

    XDocument xmlDoc = XDocument.Load(xmlfile);
            int i = 0;
            i = xmlDoc.ChildNodes(0).LastChild.Attributes("UserId").Value;

ANyone has idea??

Answers (2)