当前位置: 首页>>代码示例>>C#>>正文


C# HtmlDocument.GetInnerText方法代码示例

本文整理汇总了C#中HtmlAgilityPack.HtmlDocument.GetInnerText方法的典型用法代码示例。如果您正苦于以下问题:C# HtmlDocument.GetInnerText方法的具体用法?C# HtmlDocument.GetInnerText怎么用?C# HtmlDocument.GetInnerText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HtmlAgilityPack.HtmlDocument的用法示例。


在下文中一共展示了HtmlDocument.GetInnerText方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Fetch

        protected WeatherDataDto Fetch(HtmlDocument htmlDocument, ParseInfo parseInfo)
        {
            var description = "//*[@id='tbwdaily{0}']/tr[{1}]/td[@class='cltext']".F(parseInfo.Day, parseInfo.TimeOfDay);
            var airTemp = "//*[@id='tbwdaily{0}']/tr[{1}]/td[@class='temp']/*[@class='value m_temp c']".F(parseInfo.Day, parseInfo.TimeOfDay);
            var realFeel = "//*[@id='tbwdaily{0}']/tr[{1}]/td[7]/*[@class='value m_temp c']".F(parseInfo.Day, parseInfo.TimeOfDay);
            var pressure = "//*[@id='tbwdaily{0}']/tr[{1}]/td/*[@class='value m_press torr']".F(parseInfo.Day, parseInfo.TimeOfDay);
            var windDirection = "//*[@id='tbwdaily{0}']/tr[{1}]/td/dl[@class='wind']/dt".F(parseInfo.Day, parseInfo.TimeOfDay);
            var windSpeed = "//*[@id='tbwdaily{0}']/tr[{1}]/td/dl/dd/*[@class='value m_wind ms']".F(parseInfo.Day, parseInfo.TimeOfDay);
            var humidity = "//*[@id='tbwdaily{0}']/tr[{1}]/td[6]".F(parseInfo.Day, parseInfo.TimeOfDay);
            var date = "//*[@id='tbwdaily{0}']/tr[1]".F(parseInfo.Day);

            return new WeatherDataDto
            {
                Provider = Provider.Gismeteo,
                ProviderName = "Gismeteo",
                DateTime = this.GetDate(htmlDocument.GetAttribute(date, "id"), parseInfo.TimeOfDayKey),
                Cloudy = this.ConvertCloudy(htmlDocument.GetInnerText(description)),
                Precipitation = this.ConvertPrecipitation(htmlDocument.GetInnerText(description)),
                StrengthPrecipitation = this.ConvertStrengthPrecipitation(htmlDocument.GetInnerText(description)),
                IsFog = this.ConvertFog(htmlDocument.GetInnerText(description)),
                IsThunderstorm = this.ConvertThunderstorm(htmlDocument.GetInnerText(description)),
                AirTemp = this.ConvertTemp(htmlDocument.GetInnerText(airTemp)),
                RealFeel = this.ConvertTemp(htmlDocument.GetInnerText(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))
            };
        }
开发者ID:ripa-alexandr,项目名称:weather,代码行数:29,代码来源:GismeteoProvider.cs

示例2: Fetch

        protected WeatherDataDto Fetch(HtmlDocument htmlDocument, ParseInfo parseInfo)
        {
            var description = this.Format("//*[@id='bd{0}c']/div/div[2]/table/tbody/*[@class='img weatherIcoS']/td[{1}]/div", parseInfo.Day, parseInfo.TimeOfDay);
            var airTemp = this.Format("//*[@id='bd{0}c']/div/div[2]/table/tbody/*[@class='temperature']/td[{1}]", parseInfo.Day, parseInfo.TimeOfDay);
            var realFeel = this.Format("//*[@id='bd{0}c']/div/div[2]/table/tbody/*[@class='temperatureSens']/td[{1}]", parseInfo.Day, parseInfo.TimeOfDay);
            var pressure = this.Format("//*[@id='bd{0}c']/div/div[2]/table/tbody/*[@class='gray']/td[{1}]", parseInfo.Day, parseInfo.TimeOfDay);
            var windDirection = this.Format("//*[@id='bd{0}c']/div/div[2]/table/tbody/*[@class='gray']/td[{1}]/div", parseInfo.Day, parseInfo.TimeOfDay);
            var windSpeed = this.Format("//*[@id='bd{0}c']/div/div[2]/table/tbody/*[@class='gray']/td[{1}]/div", parseInfo.Day, parseInfo.TimeOfDay);
            var humidity = this.Format("//*[@id='bd{0}c']/div/div[2]/table/tbody/tr[6]/td[{1}]", parseInfo.Day, parseInfo.TimeOfDay);
            var chancePrecipitation = this.Format("//*[@id='bd{0}c']/div/div[2]/table/tbody/tr[8]/td[{1}]", parseInfo.Day, parseInfo.TimeOfDay);
            var date = "//*[@id='bd{0}']/p/a".F(parseInfo.Day);

            return new WeatherDataDto
            {
                Provider = Provider.Sinoptik,
                ProviderName = "Sinoptic",
                DateTime = this.GetDate(htmlDocument.GetAttribute(date, "data-link"), parseInfo.TimeOfDayKey),
                Cloudy = this.ConvertCloudy(htmlDocument.GetAttribute(description, "title")),
                Precipitation = this.ConvertPrecipitation(htmlDocument.GetAttribute(description, "title")),
                StrengthPrecipitation = this.ConvertStrengthPrecipitation(htmlDocument.GetAttribute(description, "title")),
                IsFog = this.ConvertFog(htmlDocument.GetAttribute(description, "title")),
                IsThunderstorm = this.ConvertThunderstorm(htmlDocument.GetAttribute(description, "title")),
                AirTemp = this.ConvertTemp(htmlDocument.GetInnerText(airTemp)),
                RealFeel = this.ConvertTemp(htmlDocument.GetInnerText(realFeel)),
                Pressure = Double.Parse(htmlDocument.GetInnerText(pressure)),
                WindDirection = this.ConvertWindDirection(htmlDocument.GetAttribute(windDirection, "data-tooltip")),
                WindSpeed = this.ConvertWindSpeed(htmlDocument.GetInnerText(windSpeed)),
                Humidity = Double.Parse(htmlDocument.GetInnerText(humidity)),
                ChancePrecipitation = this.ConvertChancePrecipitation(htmlDocument.GetInnerText(chancePrecipitation))
            };
        }
开发者ID:ripa-alexandr,项目名称:weather,代码行数:31,代码来源:SinoptikProvider.cs

示例3: 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))
            };
        }
开发者ID:ripa-alexandr,项目名称:weather,代码行数:36,代码来源:Rp5Provider.cs

示例4: ConvertRealFeel

        private double ConvertRealFeel(HtmlDocument htmlDocument, string sameRealFeelXPath, string airTempXPath, string realFeelXPath)
        {
            if (!string.IsNullOrEmpty(sameRealFeelXPath) && !string.IsNullOrEmpty(realFeelXPath) && !IsSameRealFeel(htmlDocument, sameRealFeelXPath))
            {
                return double.Parse(htmlDocument.GetInnerText(realFeelXPath));
            }

            return double.Parse(htmlDocument.GetInnerText(airTempXPath));
        }
开发者ID:ripa-alexandr,项目名称:weather,代码行数:9,代码来源:Rp5Provider.cs


注:本文中的HtmlAgilityPack.HtmlDocument.GetInnerText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。