Page 1 of 1

Capture Weather Data from Internet

Posted: Sat Apr 06, 2019 6:35 am
by Subho
I am newbie in IX development and my C# knowledge is very poor. It will be very helpful if any can guide me in the following topic.

I am trying to read weather data from a website which provide data in XML using following code.


namespace Neo.ApplicationFramework.Generated
{
using System.Windows.Forms;
using System;
using System.Net;
using System.Drawing;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Text;
using System.Xml;
using System.IO;
using Neo.ApplicationFramework.Tools;
using Neo.ApplicationFramework.Common.Graphics.Logic;
using Neo.ApplicationFramework.Controls;
using Neo.ApplicationFramework.Interfaces;


public partial class Screen11
{



void Btnecast_Click(System.Object sender, System.EventArgs e)
{
var client = new System.Net.WebClient();
using (client)
{
XmlDocument xml = new XmlDocument();
xml.LoadXml(client.DownloadString());
XmlElement elt;
elt = xml.SelectSingleNode("//temperature[@unit='metric']") as XmlElement;

}
}

}
}

I have successfully tested the following code in the IX PC version but when I am trying to implement the same code in X2 Base or X2 Pro getting following error for the above highlighted line.

cs0234 the type or namespace name "webclient" does not exist in the namespace 'system.net'

Re: Capture Weather Data from Internet

Posted: Tue Apr 09, 2019 6:16 am
by Subho
Solved the Problem using HttpWebRequest