I am novice to programming. I am building a c# console app. that must read several urls ending with .csv and download or copy those csv file's to the location given in the xml file.
For so far i've got the app working that the content of the file is printed on the screen, but can someone help to get the app to do what i want?
Thnx in advance
using
using System.IO;
using System.Xml;
using System.Net;
namespace Book
{///
class Class1{///
[STAThread]
static void Main(string[] args)
{XmlTextReader reader = null;
reader = new XmlTextReader("WTZI.xml");
while (reader.Read())
{if (reader.NodeType == XmlNodeType.Element)
{if(reader.LocalName.Equals("locatie"))
{Console.Write("{0}",reader.ReadString());}
if(reader.LocalName.Equals("bestemming"))
{Console.Write("{0}",reader.ReadString());}}}}}}
Content of the xml file
=====================
xml version="1.0" encoding="utf-8" ?>
<bestanden>
<bestand>
<locatie>http://www.bouwcollege.nl/Exports/CIBG/GRIP_Doelgroepen.csvlocatie>
<bestemming>c:\temp\WTZI\Doelgroepen.csvbestemming>
bestand>
<bestand>
<locatie>http://www.bouwcollege.nl/Exports/CIBG/GRIP_Instellingen.csvlocatie>
<bestemming>c:\temp\WTZI\Instellingen.csvbestemming>
bestand>
<bestand>
<locatie>http://www.bouwcollege.nl/Exports/CIBG/GRIP_Toelatingen.csvlocatie>
<bestemming>c:\temp\WTZI\Toelatingen.csvbestemming>
bestand>
<bestand>
<locatie>http://www.bouwcollege.nl/Exports/CIBG/GRIP_Toelatingfuncties.csvlocatie>
bestand>
<bestand>
<locatie>http://www.bouwcollege.nl/Exports/CIBG/GRIP_Zorgkantoren.csvlocatie>
<bestemming>c:\temp\WTZI\Zorgkantoren.csvbestemming>
bestand> bestanden>
Mike GoldPosted May 7, 2007, 3:56 PM
using System.Net;
WebClient client = new WebClient(); client.DownloadFile(new Uri("http://www.bouwcollege.nl/Exports/CIBG/GRIP_Instellingen.csv"), "c:\\myTest.csv");
e.g.