how do i filter data from my xml which Load from the web with XmlSerializer

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
How do i add a where statement and filter data
Some thing Like this
<span class="x_x_x_Apple-tab-span" style="white-space:pre where c.Attribute("title").Value == "<span style="font-family:monospace; font-size:13px; line-height:normal Daddy Scares Baby"<br/>
<span class="x_x_x_Apple-tab-span" style="white-space:pre select new employees()<br/>
<span class="x_x_x_Apple-tab-span" style="white-space:pre {<br/>
<span class="x_x_x_Apple-tab-span" style="white-space:pre title= c.Attribute("title").Value,<br/>
<span class="x_x_x_Apple-tab-span" style="white-space:pre <br/>
<span class="x_x_x_Apple-tab-span" style="white-space:pre <br/>
<span class="x_x_x_Apple-tab-span" style="white-space:pre };

<pre class="prettyprint" style=" namespace Employees
{
public partial class MainPage : PhoneApplicationPage
{
// Constructor
public MainPage()
{
InitializeComponent();
// is there network connection available
if (!System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable())
{
MessageBox.Show("No network connection available!");
return;
}
// start loading XML-data
WebClient downloader = new WebClient();
Uri uri = new Uri("http://app.livehub.org/xml/funnyvideo.xml", UriKind.Absolute);
downloader.DownloadStringCompleted += new DownloadStringCompletedEventHandler(EmployeesDownloaded);
downloader.DownloadStringAsync(uri);
}

void EmployeesDownloaded(object sender, DownloadStringCompletedEventArgs e)
{
if (e.Result == null || e.Error != null)
{
MessageBox.Show("There was an error downloading the XML-file!");
}
else
{
// Deserialize if download succeeds
XmlSerializer serializer = new XmlSerializer(typeof(Employees));
XDocument document = XDocument.Parse(e.Result);
Employees employees = (Employees)serializer.Deserialize(document.CreateReader());
employeesList.ItemsSource = employees.Collection;

}
} [/code]
<br/>
<
Solve your Problems @ http://www.livetut.com/
<br/>
<br/>

View the full article
 
Back
Top