i want to convert this code which i used it for reading xml files from windows 7 phone to winrt8

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<p style="font-family:Arial,Helvetica,sans-serif; color:#606060; padding-bottom:5px; line-height:1.5em
I used this code to read xml file in windows phone now i want to support winrt8 but the webclient api is not found can some one convert it to the proper format to read xml files
<pre class="prettyprint" style=" {WebClient downloader = new WebClient();
Uri uri = new Uri("http://app..org/Ap/super/shv04.xml", UriKind.Absolute);
downloader.DownloadStringCompleted += new DownloadStringCompletedEventHandler(EmployeesDownload);
downloader.DownloadStringAsync(uri);

}

void EmployeesDownload(object sender, DownloadStringCompletedEventArgs e)
{
// Deserialize if download succeeds
XmlSerializer serializer = new XmlSerializer(typeof(Employees));
XDocument document = XDocument.Parse(e.Result);
Employees employees = (Employees)serializer.Deserialize(new StringReader(e.Result));
employeesList.ItemsSource = employees.Collection.Where(emp => emp.control.Contains("featured")).ToList();

}[/code]
<br/>

<p style="font-family:Arial,Helvetica,sans-serif; color:#606060; padding-bottom:5px; line-height:1.5em
<br/>

my xml file look like this
<div style="font-family:monospace; font-size:13px; line-height:normal <span class="x_webkit-html-tag <root>
<div style="font-size:13px; line-height:normal
<div id="x_collapsible1

<span class="x_webkit-html-tag <employees>
<div style="
<div id="x_collapsible2

<span class="x_webkit-html-tag <employee>
<div style="
<span class="x_webkit-html-tag <control><span class="x_text featured<span class="x_webkit-html-tag </control>
<span class="x_webkit-html-tag <title><span class="x_text Old Referee<span class="x_webkit-html-tag </title>
<div id="x_collapsible3

<span class="x_webkit-html-tag <video>
<div style=" <span class="x_text http://app..org/v//.mp4
<span class="x_webkit-html-tag </video>


<span class="x_webkit-html-tag <picture><span class="x_text http://img.youtube.com/vi/pkYJQbl4vBg/1.jpg<span class="x_webkit-html-tag </picture>
<span class="x_webkit-html-tag <categories><span class="x_text workout<span class="x_webkit-html-tag </categories>

<span class="x_webkit-html-tag </employee>


<div id="x_collapsible4

<span class="x_webkit-html-tag <employee>
<div style="
<span class="x_webkit-html-tag <control><span class="x_text featured<span class="x_webkit-html-tag </control>
<span class="x_webkit-html-tag <title><span class="x_text English movie<span class="x_webkit-html-tag </title>
<div id="x_collapsible5

<span class="x_webkit-html-tag <video>
<div style=" <span class="x_text http://app..org/v//119__movie.mp4
<span class="x_webkit-html-tag </video>


<span class="x_webkit-html-tag <picture><span class="x_text http://img.youtube.com/vi/UtEFm0QftOU/1.jpg<span class="x_webkit-html-tag </picture>
<span class="x_webkit-html-tag <categories><span class="x_text celebrity<span class="x_webkit-html-tag </categories>


<span class="x_webkit-html-tag </employee>
<span class="x_webkit-html-tag </root>







the type look like this
namespace Employees<br/>
{<br/>
public class Employee<br/>
{<br/>
<br/>
[XmlElement("control")]<br/>
public string control { get; set; }<br/>
<br/>
<br/>
[XmlElement("title")]<br/>
public string title { get; set; }<br/>
<br/>
[XmlElement("video")]<br/>
public string video { get; set; }<br/>
<br/>
[XmlElement("picture")]<br/>
public string picture { get; set; }
}

<br/>
namespace Employees<br/>
{<br/>
[XmlRoot("root")]<br/>
public class Employees<br/>
{<br/>
[XmlArray("employees")]<br/>
[XmlArrayItem("employee")]<br/>
public ObservableCollection<Employee> Collection { get; set; }<br/>
<br/>
}<br/>
}<br/>



View the full article
 
Back
Top