/// <summary> /// Retrieves list of goofs from specified xml file /// </summary> /// <param name="xmlPath">path of xml file to read from</param> public IList<IIMDbGoof> ReadGoofs( string xmlPath) { try { List<IIMDbGoof> goofs = new List<IIMDbGoof>(); System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); doc.Load(xmlPath); System.Xml.XmlNodeList goofList = doc.SelectNodes("/Goofs/Goof"); if (goofList != null) foreach (System.Xml.XmlNode goofNode in goofList) { if (goofNode["Category"] != null && goofNode["Category"].InnerText != null && goofNode["Category"].InnerText.Trim() != "" && goofNode["Description"] != null && goofNode["Description"].InnerText != null && goofNode["Description"].InnerText.Trim() != "") { IMDbGoof goof = new IMDbGoof(); goof.Category = goofNode["Category"].InnerText; goof.Description = goofNode["Description"].InnerText; goofs.Add(goof); } } return goofs; } catch (Exception ex) { throw ex; } }
private void GetGoofs(ref IMDbMovie movie, string goofURL) { // get goof html string html = ToolBox.WebUtils.GetSiteContents(goofURL); //Old Code: JCUtils.WebUtils.GET(goofURL); // Grab goofs Match match = GetRegExMatch(html, _goofPattern); while (match != null && match.Length > 0) { IMDbGoof goof = new IMDbGoof(); goof.Category = GetMatchValue(match, "Category", true); goof.Description = GetMatchValue(match, "Goof", true); movie.Goofs.Add(goof); match = match.NextMatch(); } }