guiman 0 Newbie Poster

I have an xml file that looks like this for example:

<money>
<bank id="1">
<name>Checking Account</name>
<description>John Doe account</description>
</bank>
<bank id="2">
<name>Savings Account</name>
<description>Bob Smith account</description>
</bank>
<bank >
.....
</bank>
</money>

I need to parse through, and get the attribute value of <bank>, and the node value of <name> and <description>. What is the best way to do that, using XmlDocument parser?

I think I need to do something like this:
XmlNodeList banknodes = doc.SelectNodes("/money/bank");
foreach (XmlNode xn in banknodes)
But I am not sure how to get the attritube value of the bank node and the regular values of the other non-attribute tags.
Any advice would be appreciated.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.