public ArticleView(Main m, int[] i, Article ar, Annotation an) { InitializeComponent(); this.Text = ar.Title; textBoxes.Add(textBox6); textBoxes.Add(textBox7); textBoxes.Add(textBox8); textBoxes.Add(textBox9); textBoxes.Add(textBox10); this.m = m; this.i = i; this.ar = ar; this.an = an; textBox1.Text = ar.Title; textBox2.Text = ar.Author; dateTimePicker1.Value = ar.Date; textBox4.Text = ar.Link; textBox5.Text = ar.Body; textBox6.Text = an.Who; textBox7.Text = an.When; textBox8.Text = an.Where; textBox9.Text = an.What; textBox10.Text = an.Why; }
public List<Article> parseFile(String path) { List<Article> articleList = new List<Article>(); try { String xmlContents = ""; using (StreamReader streamReader = new StreamReader(path, Encoding.UTF8)) { xmlContents = streamReader.ReadToEnd(); } xmlContents = WebUtility.HtmlDecode(xmlContents); xmlContents = xmlContents.Replace("&", "&"); XmlDocument doc = new XmlDocument(); doc.LoadXml(xmlContents); XmlNodeList articleNodes = doc.DocumentElement.SelectNodes("/data/article"); foreach (XmlNode articleNode in articleNodes) { Article article = new Article(); article.Author = articleNode.SelectSingleNode("author").InnerText; article.Body = WebUtility.HtmlDecode(articleNode.SelectSingleNode("body").InnerText); article.Link = articleNode.SelectSingleNode("link").InnerText; article.Title = WebUtility.HtmlDecode(articleNode.SelectSingleNode("title").InnerText); String date = articleNode.SelectSingleNode("date").SelectSingleNode("month").InnerText + "/" + articleNode.SelectSingleNode("date").SelectSingleNode("day").InnerText + "/" + articleNode.SelectSingleNode("date").SelectSingleNode("year").InnerText; DateTime tempDate = new DateTime(2000, 01, 01); DateTime.TryParse(date, out tempDate); article.Date = tempDate; articleList.Add(article); } } catch (Exception e) { Console.WriteLine("Error while parsing file: " + e); } return articleList; }
internal static void setArticle(Article inputArticle) { article = inputArticle; }
public void setCurrentArticle(Article pArticle) { articleCurrent = pArticle; }