public static Objects.AllotmentXpathObject GetAllotmentXPath() { var elbo = new BO.ElementLabelBO(); var px = new Objects.AllotmentXpathObject(); var elmAllotment = elbo.GetLabel(45); var elmDate = elbo.GetLabel(43); var elmCloseOut = elbo.GetLabel(46); var elmRoomName = elbo.GetLabel(44); var elmRowXPath = elbo.GetLabel(42); px.Allotment = new Objects.XPathItem { AttributeName = "value", XPath = elmAllotment.XPath }; px.CloseOut = new Objects.XPathItem { AttributeName = "checked", XPath = elmCloseOut.XPath }; px.DateXPath = new Objects.XPathItem { AttributeName = "value", XPath = elmDate.XPath }; px.RoomName = new Objects.XPathItem { AttributeName = "value", XPath = elmRoomName.XPath }; px.RowXPath = new Objects.XPathItem { AttributeName = null, XPath = elmRowXPath.XPath }; return(px); }
public List <Objects.AllotmentRecord> AnalyzeData(string html) { if (objXpath == null || _resetXpathOnload) { objXpath = Modules.XPathLoader.GetAllotmentXPath(); } var doc = new HtmlAgilityPack.HtmlDocument(); doc.LoadHtml(html); var nn = doc.DocumentNode.SelectNodes(objXpath.RowXPath.XPath); if (nn == null) { return(null); } // Console.WriteLine("xpath: " + objXpath.CloseOut.XPath); var nodes = nn.ToList(); var arecords = new List <Objects.AllotmentRecord>(); foreach (var r in nodes) { var arecord = new Objects.AllotmentRecord(); arecord.AllotmentString = GetNodeInnerTextOrAttributeValue(r, objXpath.Allotment); arecord.CloseoutString = GetNodeInnerTextOrAttributeValue(r, objXpath.CloseOut); arecord.DateString = GetNodeInnerTextOrAttributeValue(r, objXpath.DateXPath); arecord.RoomName = GetNodeInnerTextOrAttributeValue(r, objXpath.RoomName); arecords.Add(arecord); } return(arecords); }