protected void ReadXml_Click(object sender, EventArgs e) { Global_collection collection_news = new Global_collection(); collection_news.readXml(); var list = collection_news.get(); text = ""; foreach (var element in list) { //Debug.WriteLine("element.type); text += "id = " + element.id.ToString() + "\n"; text += "type = " + element.type + "\n"; text += "sourse = " + element.source + "\n"; text += "title = " + element.title + "\n"; text += "content = " + element.content + "\n"; text += "image = " + element.image + "\n"; text += "\n"; Debug.WriteLine(text); } Output_new.Text = text; update(); }
// GET: api/values public List <object_news> Get() { try { Spiders spider = new Spiders(); Global_collection collections = new Global_collection(); collections.add(spider.theverge_com()); return(collections.getList()); } catch { Global_collection collections = new Global_collection(); collections.readXml(); return(collections.getList()); } }