c# - Windows app to get XML data from a website containing XML data -


I'm trying to come up with a Windows Forms Application (or WPF) developed in C #. Get XML node data related to user search from a website containing XML, this application will be linked to a website containing XMT from the website and will catch the XML nodes relevant to the website. Then I will display the XML node data on my Windows app, what is the best way to do this, it will also be an extension to catch all the XML and store it in a data tier. A sample website I will be similar to this page

"post-text" itemprop = "text">

Not entirely sure what your questions are - Are you asking how to get it (downloading xml), or where is it best or what?

To catch XML, use something like this:

  using System.Net; Web client client = new webclient (); String result = client.DownloadString ("http://www.amk.ca/quotations/sherlock-holmes.xml");  

You withdraw a string of XML, which you can now parse using XMLDocument or XDcast (Linux-to-XML) - how are you asking for it?

Or if you know what sites and format XML you are hitting ahead of time, you can also download XML and make it XML schema, and in the second step, XML C # class can generate. The schema which would be appropriate for Dualizing XML String Quotation category (based on & lt; citation & gt; tag in the sample XML provided)

Update: If you are in the form of a sample XML file, you can use XML to generate an XML schema from xsd.exe command line You can use the utility, and on the basis of that XML schema, you can create C # classes that you use for more information on Deserialization.

Actually, calling xsd.exe (yourfile.xml) will generate a yourfile.xsd XML schema based on your XML. The input file, and xsd.exe / c (yourfile.xsd) is running will generate a C # class from that XML schema.

To use it, you can digitize your XML in a step in the C # class and then navigate around the lists of its properties and its sub-lists, then the contents of XML "Explore." / P>

This desriialization will appear something like this:

  XmlSerializer deserializer = new XML sheller (ThatDataTypeGenerated); Object result = deserializer Dairyialize (& lt; either a file's name, or a stream or something & gt;);  

It works by following the address next to the XML type you will receive (so that you can generate it from the XML schema and C # class, Ahead of time).

In addition, you can also do the first step (convert XML data file into Schema) within Visual Studio (menu "XML" -> "Generate XML Schema"), and the other For the XS XML Schema in the C # class), you can take a look like something.


Comments