本文整理汇总了C#中HtmlAgilityPack.HtmlDocument.IsAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# HtmlDocument.IsAttribute方法的具体用法?C# HtmlDocument.IsAttribute怎么用?C# HtmlDocument.IsAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HtmlAgilityPack.HtmlDocument
的用法示例。
在下文中一共展示了HtmlDocument.IsAttribute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Fetch
protected WeatherDataDto Fetch(HtmlDocument htmlDocument, ParseInfo parseInfo)
{
var cloudy = GetXPath(htmlDocument, "Облачность", "/td[{0}]/div[1]/div".F(parseInfo.TimeOfDay));
// In one time of day two description
var description = GetXPath(htmlDocument, "Явления погоды", "/td[{0}]/div[1]".F(parseInfo.TimeOfDay * 2 - 2));
var isFog = "//*[@id='forecastTable']/tr[5]/td[{0}]/div[1]".F(parseInfo.TimeOfDay - 1);
var airTemp = GetXPath(htmlDocument, "Температура", "/td[{0}]/div[1]/b".F(parseInfo.TimeOfDay));
var realFeel = GetXPath(htmlDocument, "Ощущается", "/td[{0}]/div[1]".F(parseInfo.TimeOfDay));
var sameRealFeel = GetXPath(htmlDocument, "Ощущается", "/td[{0}]".F(parseInfo.TimeOfDay));
var pressure = "//*[@id='forecastTable']/tr[last()-7]/td[{0}]/div[1]/b|//*[@id='forecastTable']/tr[last()-7]/td[{0}]/div[1]".F(parseInfo.TimeOfDay);
var windDirection = "//*[@id='forecastTable']/tr[last()-4]/td[{0}]".F(parseInfo.TimeOfDay);
var windSpeed = GetAvailablePath(htmlDocument,
"//*[@id='forecastTable']/tr[last()-6]/td[{0}]/div[1]".F(parseInfo.TimeOfDay),
"//*[@id='forecastTable']/tr[last()-6]/td[{0}]".F(parseInfo.TimeOfDay));
var humidity = "//*[@id='forecastTable']/tr[last()-3]/td[{0}]".F(parseInfo.TimeOfDay);
var date = "//*[@id='forecastTable']/tr[1]/td[{0}]/div/div/span[2]".F(parseInfo.Day);
return new WeatherDataDto
{
Provider = Provider.Rp5,
ProviderName = "Rp5",
DateTime = this.GetDateInTable(htmlDocument.GetInnerText(date), parseInfo.TimeOfDayKey),
Cloudy = this.ConvertCloudy(htmlDocument.GetAttribute(cloudy, "onmouseover")),
Precipitation = this.ConvertPrecipitation(htmlDocument.GetAttribute(description, "onmouseover")),
StrengthPrecipitation = this.ConvertStrengthPrecipitation(htmlDocument.GetAttribute(description, "onmouseover")),
IsFog = this.ConvertFog(htmlDocument.IsAttribute(isFog, "onmouseover") ? htmlDocument.GetAttribute(isFog, "onmouseover") : string.Empty),
IsThunderstorm = this.ConvertThunderstorm(htmlDocument.GetAttribute(description, "onmouseover")),
AirTemp = Int32.Parse(htmlDocument.GetInnerText(airTemp)),
RealFeel = this.ConvertRealFeel(htmlDocument, sameRealFeel, airTemp, realFeel),
Pressure = Double.Parse(htmlDocument.GetInnerText(pressure)),
WindDirection = this.ConvertWindDirection(htmlDocument.GetInnerText(windDirection)),
WindSpeed = Double.Parse(htmlDocument.GetInnerText(windSpeed)),
Humidity = Double.Parse(htmlDocument.GetInnerText(humidity))
};
}
示例2: IsSameRealFeel
private bool IsSameRealFeel(HtmlDocument htmlDocument, string sameRealFeelXPath)
{
var isSameRealFeel = htmlDocument.IsAttribute(sameRealFeelXPath, "onmouseover");
return isSameRealFeel && IsMatch(htmlDocument.GetAttribute(sameRealFeelXPath, "onmouseover"), "равно значению температуры воздуха");
}