C # XML Data Reading in the URL

Source: Internet
Author: User
Normally, XML files are read from static files, but XML data is updated at any time in the securities field.

For example, if a third party wants us to provide XML data, we develop it for the second party, and the third party provides us withURL, ThisURLThe content is in XML format and contains the data we need.

Can I tell you how to read static files?URLIs the method the same? Just Replace "data. xml" with "http://www.yesky.com/news/stock.asp? Code = 0002 ????

A: It can be implemented in this way. Please referC #Code

See the following code:

Using system;
Using system. IO;
Using system. xml;
Public class sample
{
Public static void main ()
{
// Create the xmldocument.
Xmldocument Doc = new xmldocument ();
// Load the XML file from a remoteURL
Doc. Load ("http://www.yesky.com/news/stock.asp ");
Doc. Save (console. Out );
}
}

In this way,C #ProgramThe XML uploaded from the remote ASP page is displayed on the console. Out (console output.

 

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.