Hi,
I have some data stored on an XML file and I am trying to read a specific part of it.
Here is a line from the XML:-
<photo id="4539802593" owner="***" secret="***" server="4032" farm="5" title="Stone Bridge" ispublic="1" isfriend="0" isfamily="0" />
Below is the bare bones of code I am using to read the file:-
void Button2Click(object sender, EventArgs e)
{
XmlDocument xDoc = new XmlDocument();
xDoc.Load(System.IO.Path.Combine(Application.StartupPath, "api.xml"));
XmlNodeList photo = xDoc.GetElementsByTagName("photo");
MessageBox.Show(photo[0].OuterXml);
}
It loads and reads the file without a problem but obviously reads the whole line.
I would like it to just read the {id=} bit.
I have tried putting
XmlNodeList id = xDoc.GetElementsByTagName("id");
MessageBox.Show(id[0].OuterXml);
but just get an error.
Kind regards..,
MT ;)