Hi,
I have a query:
I have a XML file in one of the Folder in the Silverlight Hosting Web Project. I read the XML file in my Silverlight XAML file and perform my stuff.
I am using below code for reading the same:
HttpWebRequest xmlCommonData = (HttpWebRequest)WebRequest.Create(new Uri(GetAppPath() + "XML/Common.xml"));
xmlCommonData.BeginGetResponse(
new AsyncCallback(CommonDataResponseCallBack), xmlCommonData);HttpWebRequest xmlCommonData = (HttpWebRequest)asyncResult.AsyncState;
HttpWebResponse CommonDataResponse = (HttpWebResponse)xmlCommonData.EndGetResponse(asyncResult);Stream CommonDataStream = CommonDataResponse.GetResponseStream();
using (XmlReader reader = XmlReader.Create(CommonDataStream))
.......My custom code....
I want to know If this approach of reading the XML file is better or using the WebClient approach..Can someone tell me the difference betwen two?
WebClient code:
WebClient webClient = new WebClient();
webClient.DownloadProgressChanged +=
new DownloadProgressChangedEventHandler(webClient_DownloadProgressChanged);webClient.OpenReadCompleted += new OpenReadCompletedEventHandler(webClient_OpenReadCompleted);
try
{
webClient.DownloadStringAsync(new Uri("http://localhost:8888/xdata.xml"));
}
....
regards,
Parimal