private static Content Process(HtmlDocument document, string xpath) { if (xpath == null) { throw new Exception("The xpath has not been specified"); } var found = document.DocumentNode.SelectNodes( xpath) .Where(n => !n.InnerText.Trim('\r', '\n').Trim().Equals("")); var content = new Content(); foreach (var paragraph in found) { content.AddChapter(paragraph.InnerText); } return(content); }