Hi All,
i am trying to read xml data using c#,here ia m facing the issue is i am not able to read the data.
i am trying to implement getting yahoo stickers data from yahoo url and bind into table.
The data contains URL and read that data and bind to table.
i am using the below code
string yahooURL = ConnectionStrings.yahooURL;
string symbolList = String.Join("%2C", Quotes.Select(w => "%22" + w.Symbol + "%22").ToArray());
string url = string.Format(yahooURL,symbolList);
XDocument doc = XDocument.Load(url);
XElement results = doc.Root.Element("results");
foreach (Quote quote in Quotes)
{
Watchlist objPC = new Watchlist();
XElement q = results.Elements("quote").First(w => w.Attribute("symbol").Value == quote.Symbol);
objPC.Symbol = quote.Symbol;
objPC.Name = q.Element("Name").Value;
objPC.Price = GetDecimal(q.Element("LastTradePriceOnly").Value);
objPC.Change = GetDecimal(q.Element("Change").Value);
objPC.ChangeInPercent = GetDecimal(q.Element("ChangeinPercent").Value);
objPC.Volume = GetDecimal(q.Element("Volume").Value);
objPC.DaysRange = q.Element("DaysRange").Value;
objPC.YearRange = q.Element("YearRange").Value;
objPC.MarketCapitalization = q.Element("MarketCapitalization").Value;
propClass.Add(objPC);
}
here i am getting the error is "
'>' is an unexpected token. The expected token is '"' or '''. Line 1, position 50.
the below line i am getting the error
XDocument doc = XDocument.Load(url);
Any Body can Please share solution to me.
this is the url
http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22FLWS%22)&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys[
^]
What I have tried:
Here i am getting URL and that URL the xml data is coming,But i am not able to read the data.