Example #1
0
        /// <summary>
        /// 解析航线信息
        /// </summary>
        /// <param name="strContent">航线内容</param>
        /// <param name="regexInstance">正则实例</param>
        /// <returns></returns>
        public IList <RouteInformation> ParseHtmlCode(string strContent, IRegexExpression regexInstance)
        {
            if (string.IsNullOrEmpty(strContent) || regexInstance == null)
            {
                return(null);
            }

            CtripRegexExpression ctripRegex = (CtripRegexExpression)regexInstance;

            IList <string> valueList = RegexOperation.GetValuesByRegex(ctripRegex.GetSingleRowRegex(), strContent);

            IList <RouteInformation> routeInformationList = new List <RouteInformation>();
            RouteInformation         routeInformation;

            foreach (string strValue in valueList)
            {
                routeInformation = GetRouteInformation(strValue, ctripRegex);

                if (routeInformation != null)
                {
                    routeInformation.SeatList = GetSeatInformation(routeInformation, ctripRegex);

                    routeInformationList.Add(routeInformation);
                }
            }

            return(routeInformationList);
        }