xml - building an XDocument with a webclient downloaded string -
i using following methods download xml file
private void loadxmlfile() {   webclient xmlclient = new webclient();   xmlclient.downloadstringcompleted += new downloadstringcompletedeventhandler(xmlfileloaded);   xmlclient.downloadstringasync(new uri("chart.xml", urikind.relativeorabsolute)); }  void xmlfileloaded(object sender, downloadstringcompletedeventargs e) {   if (e.error == null)   {     string xmldata = e.result;     htmlpage.window.alert(xmldata);     x2 = new xdocument(xmldata);   } }    i want use information inside xmldata build xdocument, trying in last line. not give errors program not work must not correctly making xdocument. assiging xml document directly x2
x2 = xdocument.load("chart.xml")   works.
but need through webclient. doing wrong here
once you've got xmldata string, it's easy - use xdocument.parse:
xdocument doc = xdocument.parse(xmldata);   could elaborate why need use webclient rather xdocument.load though? make call asynchronous?
Comments
Post a Comment