i have an xml file as follows:
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
i want to if i given an argument, say "ARTIST" element - "Queen", i shud get the value of the "TITLE" element associated with it, i.e. "A Night at the Opera".
Please let me the code of how to go about it... ( i m currently using GetElementsByTagName to get the value)

Craig MurphyRank #2,956 · 488 reputationPosted May 5, 2006, 1:44 AM EDT
XmlDocument doc = new XmlDocument();
doc.LoadXml(
"textBox1.Text = doc.InnerXml;
XmlNode node = doc.SelectSingleNode("COLLECTION/CD[ARTIST='Queen']/TITLE");textBox2.Text = node.InnerXml;
GetElementsByTagName is useful if you want a list of elements back, however it doesn't help if your want 'specific' elements back...as in your case.HTH
Ziangi Jones7 reputationPosted May 5, 2006, 2:36 AM EDT
xml version=”1.0” encoding=”UTF-8” standalone=”yes”?>
I m doing the foll. now:
XmlDocument doc = new XmlDocument();
doc.Load(XMLPath);
XmlElement elem = doc.GetElementById("a11");
MessageBox.Show(elem.OuterXml);
wat i get is the complete thing:
Is it possible to get either ONLY 'a11' or 'Queen.'
Thank you.
Craig MurphyRank #2,956 · 488 reputationPosted May 5, 2006, 3:22 AM EDT
node = doc.SelectSingleNode(
"COLLECTION/CD/ARTIST[@ssn='a12']");However, thinking to your next question, you might like to put the ssn on the CD element, such that when you query for a12, you get back ARTIST, YEAR, TITLE...
HTH