Why does my program (c#) take forever to get the post data from server using SelectNode with xml



So I have a HTTP post request going to the server then the server is responding back in sending me data about user like userID in xml format. Then I read in the information via this code.. But it takes a while to read in from the response. Anyone knows a faster way?



//read response
var xml = new StreamReader(response.GetResponseStream()).ReadToEnd();


// XML TYPES
XmlDocument xml2 = new XmlDocument();
xml2.LoadXml(xml);
// select data
XmlNodeList info = xml2.SelectNodes("/UserInfo/");
foreach (XmlNode u in info)
{


string id = u["id"].InnerText;
string username = u["username"].InnerText;
string money = u["money_owed"].InnerText;
UID.Text = id;
username.Text = username;
OWED.Text = money;

}


And I got a couple more things I select. Much appreciated for the help.


No comments:

Post a Comment