c# - XMLNODE: how can i select this node with attribute in my xml -


i have xml following structure

<student>     <name fname="oliver">     </name>     <name fname="de">     </name>     <name fname="johnson">     </name> </student> 

my code this:

//after loading xmldocument called xmlrecord

    xmlnode row = xmlrecord.selectsinglenode("/student");     student.fname = row.selectsinglenode("name[fname]"); 

but not returning anything. pls best way select fname='johnson' node?

you want fname attribute of first <name> element, should write:

student.fname = row.selectsinglenode("name/@fname"); 

Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -