WP7 reads XML files from the network and locally

Source: Internet
Author: User

New local New. xml

<? XML version = "1.0" encoding = "UTF-8"?>

<New>
<ID> 1 </ID>
<Name> retro TV </Name>
<Image_url> http://www.bb.immmooo.com/CMS//images/stories/mmmooo/small_mmmooo-img1332677403.png </image_url>
<DESC>★Feeling, just so good!★Designing, just fabulous!★Idea, just unique!★Quality, just 100% approved. </DESC>
<Download_url> http://www.mmmooo.net/wp </download_url>
</New>

L

 

Private void button#click (Object sender, routedeventargs E)
{
// Read the XML file of the Network
WebClient modelclient = new WebClient ();

Modelclient. downloadstringcompleted + = new downloadstringcompletedeventhandler (client_downloadstringcompleted );
Modelclient. downloadstringasync (New uri ("http://www.mmmooo.net/wp/index.xml "));

// Read the local XML file
// Xdocument loadeddata = xdocument. Load ("New. xml ");
// Var DATA = from query in loadeddata. descendants ("new") Select New wpnew {name = (string) query. element ("name"), image_url = (string) query. element ("image_url"), download_url = (string) query. element ("download_url ")};

// Txtname. Text = data. First (). Name;
// Txtimag. Text = data. First (). image_url;
// Txtdownload. Text = data. First (). download_url;

}
Void client_downloadstringcompleted (Object sender, downloadstringcompletedeventargs E)
{

// If (E. Result! = NULL)
//{
// Xmlreader xml = xmlreader. Create (New stringreader (E. Result ));
// Xelement Xe = xelement. Load (XML );

// Xdocument loadeddata = Xe. Document;

// Txtname. Text = Xe. element ("name"). value;
// Txtimag. Text = Xe. element ("image_url"). value;
// Txtdownload. Text = Xe. element ("download_url"). value;
//}

// If (E. Result! = NULL)
//{
// Xdocument Doc = xdocument. Load (New stringreader (E. Result ));
// Var DATA = from query in Doc. descendants ("new") Select New wpnew {name = (string) query. element ("name"), image_url = (string) query. element ("image_url"), download_url = (string) query. element ("download_url ")};
// Txtname. Text = data. First (). Name;
// Txtimag. Text = data. First (). image_url;
// Txtdownload. Text = data. First (). download_url;
//}
If (E. Result! = NULL)
{
// Stream S = E. result;
Xdocument Doc = xdocument. parse (E. Result );
VaR DATA = from query in Doc. descendants ("new") Select New wpnew {name = (string) query. element ("name"), image_url = (string) query. element ("image_url"), download_url = (string) query. element ("download_url ")};
Txtname. Text = data. First (). Name;
Txtimag. Text = data. First (). image_url;
Txtdownload. Text = data. First (). download_url;
}
If (E. Result! = NULL)
{
// Stream S = new stream (E. Result );
Xdocument Doc = xdocument. parse (E. Result, loadoptions. setlineinfo );
VaR DATA = from query in Doc. descendants ("new") Select New wpnew {name = (string) query. element ("name"), image_url = (string) query. element ("image_url"), download_url = (string) query. element ("download_url ")};
Txtname. Text = data. First (). Name;
Txtimag. Text = data. First (). image_url;
Txtdownload. Text = data. First (). download_url;
}

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.