JackBurton07
IS-IT--Management
Hi I want to properly display a webservice xml data in an application but i keep getting: illegal characters in path error
what am i doing wrong?
public Form1()
{
InitializeComponent();
}
WSREF.StockQuote ws;
private void Form1_Load(object sender, EventArgs e)
{
ws = new WSREF.StockQuote();
}
private void button1_Click(object sender, EventArgs e)
{
string url = ws.GetQuote(txtInput.Text);
WebClient c = new WebClient();
string xml = ASCIIEncoding.Default.GetString(c.DownloadData(url));
XmlDocument doc = new XmlDocument();
doc.LoadXml(xml);
foreach (XmlNode node in doc.SelectNodes("/Stock"))
Trace.WriteLine(node.InnerText);
The XML returned data from the webservice is :
<?xml version="1.0" encoding="utf-8" ?>
<string xmlns="<Last>176.70</Last><Date>2/28/2008</Date><Time>4:01pm</Time><Change>-4.10
</Change><Open>180.28</Open><High>180.28</High><Low>175.57</Low><Volume>
8828201</Volume><MktCap>69.957B</MktCap><PreviousClose>180.80
</PreviousClose><PercentageChange>-2.27%</PercentageChange><AnnRange>
157.38 - 250.70</AnnRange><Earns>24.733</Earns><P-E>7.31</P-E><Name>
GOLDMAN SACHS GRP</Name></Stock></StockQuotes></string>
what am i doing wrong?
public Form1()
{
InitializeComponent();
}
WSREF.StockQuote ws;
private void Form1_Load(object sender, EventArgs e)
{
ws = new WSREF.StockQuote();
}
private void button1_Click(object sender, EventArgs e)
{
string url = ws.GetQuote(txtInput.Text);
WebClient c = new WebClient();
string xml = ASCIIEncoding.Default.GetString(c.DownloadData(url));
XmlDocument doc = new XmlDocument();
doc.LoadXml(xml);
foreach (XmlNode node in doc.SelectNodes("/Stock"))
Trace.WriteLine(node.InnerText);
The XML returned data from the webservice is :
<?xml version="1.0" encoding="utf-8" ?>
<string xmlns="<Last>176.70</Last><Date>2/28/2008</Date><Time>4:01pm</Time><Change>-4.10
</Change><Open>180.28</Open><High>180.28</High><Low>175.57</Low><Volume>
8828201</Volume><MktCap>69.957B</MktCap><PreviousClose>180.80
</PreviousClose><PercentageChange>-2.27%</PercentageChange><AnnRange>
157.38 - 250.70</AnnRange><Earns>24.733</Earns><P-E>7.31</P-E><Name>
GOLDMAN SACHS GRP</Name></Stock></StockQuotes></string>