public WolframAlphaQueryResult LoadResponse(XmlDocument Response) { System.Threading.Thread.Sleep(1); XmlNode MainNode = Response.SelectNodes("/queryresult")[0]; WA_QueryResult = new WolframAlphaQueryResult(); WA_QueryResult.Success = MainNode.Attributes["success"].Value.toBool(); WA_QueryResult.ErrorOccured = MainNode.Attributes["error"].Value.toBool(); WA_QueryResult.NumberOfPods = MainNode.Attributes["numpods"].Value.toInt(); WA_QueryResult.Timing = MainNode.Attributes["timing"].Value.toDouble(); WA_QueryResult.TimedOut = MainNode.Attributes["timedout"].Value; WA_QueryResult.DataTypes = MainNode.Attributes["datatypes"].Value; WA_QueryResult.Pods = new List<WolframAlphaPod>(); foreach (XmlNode Node in MainNode.SelectNodes("pod")) { System.Threading.Thread.Sleep(1); WolframAlphaPod Pod = new WolframAlphaPod(); Pod.Title = Node.Attributes["title"].Value; Pod.Scanner = Node.Attributes["scanner"].Value; Pod.Position = Node.Attributes["position"].Value.toInt(); Pod.ErrorOccured = Node.Attributes["error"].Value.toBool(); Pod.NumberOfSubPods = Node.Attributes["numsubpods"].Value.toInt(); Pod.SubPods = new List<WolframAlphaSubPod>(); foreach (XmlNode SubNode in Node.SelectNodes("subpod")) { System.Threading.Thread.Sleep(1); WolframAlphaSubPod SubPod = new WolframAlphaSubPod(); SubPod.Title = SubNode.Attributes["title"].Value; foreach (XmlNode ContentNode in SubNode.SelectNodes("plaintext")) { System.Threading.Thread.Sleep(1); SubPod.PodText = ContentNode.InnerText; } foreach (XmlNode ContentNode in SubNode.SelectNodes("img")) { System.Threading.Thread.Sleep(1); WolframAlphaImage Image = new WolframAlphaImage(); Image.Location = new Uri(ContentNode.Attributes["src"].Value); Image.HoverText = ContentNode.Attributes["alt"].Value; Image.Title = ContentNode.Attributes["title"].Value; Image.Width = ContentNode.Attributes["width"].Value.toInt(); Image.Height = ContentNode.Attributes["height"].Value.toInt(); SubPod.PodImage = Image; } Pod.SubPods.Add(SubPod); } WA_QueryResult.Pods.Add(Pod); } return WA_QueryResult; }
public WolframAlphaQueryResult LoadResponse(XmlDocument Response) { System.Threading.Thread.Sleep(1); XmlNode MainNode = Response.SelectNodes("/queryresult")[0]; WA_QueryResult = new WolframAlphaQueryResult(); WA_QueryResult.Success = MainNode.Attributes["success"].Value.toBool(); WA_QueryResult.ErrorOccured = MainNode.Attributes["error"].Value.toBool(); WA_QueryResult.NumberOfPods = MainNode.Attributes["numpods"].Value.toInt(); WA_QueryResult.Timing = MainNode.Attributes["timing"].Value.toDouble(); WA_QueryResult.TimedOut = MainNode.Attributes["timedout"].Value; WA_QueryResult.DataTypes = MainNode.Attributes["datatypes"].Value; WA_QueryResult.Pods = new List <WolframAlphaPod>(); foreach (XmlNode Node in MainNode.SelectNodes("pod")) { System.Threading.Thread.Sleep(1); WolframAlphaPod Pod = new WolframAlphaPod(); Pod.Title = Node.Attributes["title"].Value; Pod.Scanner = Node.Attributes["scanner"].Value; Pod.Position = Node.Attributes["position"].Value.toInt(); Pod.ErrorOccured = Node.Attributes["error"].Value.toBool(); Pod.NumberOfSubPods = Node.Attributes["numsubpods"].Value.toInt(); Pod.SubPods = new List <WolframAlphaSubPod>(); foreach (XmlNode SubNode in Node.SelectNodes("subpod")) { System.Threading.Thread.Sleep(1); WolframAlphaSubPod SubPod = new WolframAlphaSubPod(); SubPod.Title = SubNode.Attributes["title"].Value; foreach (XmlNode ContentNode in SubNode.SelectNodes("plaintext")) { System.Threading.Thread.Sleep(1); SubPod.PodText = ContentNode.InnerText; } foreach (XmlNode ContentNode in SubNode.SelectNodes("img")) { System.Threading.Thread.Sleep(1); WolframAlphaImage Image = new WolframAlphaImage(); Image.Location = new Uri(ContentNode.Attributes["src"].Value); Image.HoverText = ContentNode.Attributes["alt"].Value; Image.Title = ContentNode.Attributes["title"].Value; Image.Width = ContentNode.Attributes["width"].Value.toInt(); Image.Height = ContentNode.Attributes["height"].Value.toInt(); SubPod.PodImage = Image; } Pod.SubPods.Add(SubPod); } WA_QueryResult.Pods.Add(Pod); } return(WA_QueryResult); }