Ok. So in the following section from my XML document, I have two attributes in the Unit tag. The first, type, and the second uname. I wish to click, say a button that says "Troop" on it, and the program will search through the XML file and find the entries that are of element "Unit" and type="Troop", then output just the uname into a dataGridView. In this instance it would output just "No Light".
Right now I have the button set to just display all attributes from all entries in the file into the dataGridView. The link is an example of the output.
I just have no idea how to have it search for an attribute, or how to output just one. The rest, likely an "if" statement, makes decent sense to me.
Thank you so much for any help you can offer.
http://i246.photobucket.com/albums/gg83/templersstorms/LM_v005.jpg
<Unit type="Troop" uname="No Light">
<Name>No Light</Name>
<Points>15</Points>
<WS>3</WS>
<BS>3</BS>
<S>2</S>
<T>3</T>
<W>1</W>
<I>4</I>
<A>1</A>
<Ld>9</Ld>
<Sv>5+*</Sv>
</Unit>
And here is the program code for the Troop Button.
private void button3_Click(object sender, EventArgs e)
{
dataGridView1.DataSource = null;
XmlDataDocument xmldataTroop = new XmlDataDocument();
xmldataTroop.DataSet.ReadXml(textBox1.Text);
DataSet dsTroop = new DataSet("Troops");
dsTroop = xmldataTroop.DataSet;
dataGridView1.DataSource = dsTroop.DefaultViewManager;
dataGridView1.DataMember = "Unit";
}