If possible, please make it read the
C# XML Help!
Hi, I was wondering how I could make C# read XML off a website. Also, the website I want it to read is http://xboxapi.duncanmackenzie.net/gamertag.ashx?GamerTag=experiment5x.
If possible, please make it read the through text. Thanks.
If possible, please make it read the

Jaish MathewsRank #225 · 11K reputationPosted May 29, 2010, 9:10 AM EDT
Many ways. It's basic XML Parsing. Below I used one way to get the title.
WebClient client = new WebClient();
string URL = "http://xboxapi.duncanmackenzie.net/gamertag.ashx?GamerTag=experiment5x";
Stream data = client.OpenRead(URL);
StreamReader reader = new StreamReader(data);
string s = reader.ReadToEnd();
XmlDocument doc = new XmlDocument();
doc.LoadXml(s);
string title = doc.SelectSingleNode("XboxInfo/PresenceInfo/Title").InnerText;
data.Close();
reader.Close();
CrishRank #1,487 · 1.1K reputationPosted May 27, 2010, 7:44 PM EDT
try below links..
http://www.codeproject.com/KB/XML/csreadxml1.aspx
http://www.c-sharpcorner.com/UploadFile/mahesh/ReadingXmlFile11142005002137AM/ReadingXmlFile.aspx
for reading " http://xboxapi.duncanmackenzie.net/gamertag.ashx?GamerTag=experiment5x" you need to use XMLHTTP object in ASP.Net
Don't forget to Mark Do you like this Answer that solved your problem!
Steve8 reputationPosted May 27, 2010, 7:48 PM EDT
Jaish MathewsRank #225 · 11K reputationPosted May 27, 2010, 9:10 PM EDT
Use WebClient class like below. You will get exact out put in a variable. So you can modify it in your oen way.
WebClient client = new WebClient();
string URL = "http://xboxapi.duncanmackenzie.net/gamertag.ashx?GamerTag=experiment5x";
Stream data = client.OpenRead(URL);
StreamReader reader = new StreamReader(data);
string s = reader.ReadToEnd();
Console.WriteLine(s);
data.Close();
reader.Close();
Steve8 reputationPosted May 28, 2010, 6:48 AM EDT