Example #1
0
        /*        /// <summary>
         * ///     返回自营店的店铺编号列表
         * /// </summary>
         * /// <param name="shopDictionary">The shop dictionary.</param>
         * /// <returns></returns>
         * private string[] GetSelfSupportShopIds(IDictionary<string, IResut> shopDictionary)
         * {
         *  var shopIdList = new List<string>();
         *
         *  foreach (var shopItem in shopDictionary)
         *  {
         *      var shopId = shopItem.Key;
         *      if (shopItem.Value.GetStringValue(@"vender_type") == "0")
         *      {
         *          shopIdList.Add(shopId);
         *      }
         *  }
         *
         *  return shopIdList.ToArray();
         * }*/

        /// <summary>
        ///     Parses the identifier from xpath.
        /// </summary>
        /// <param name="htmlSource">The HTML source.</param>
        /// <param name="xpath">The xpath.</param>
        /// <returns></returns>
        private string[] ParseIdFromXpath(string htmlSource, string xpath)
        {
            var navigator = HtmlDocumentHelper.CreateNavigator(htmlSource);
            var iterator  = navigator.Select(xpath);
            var xItems    = HtmlDocumentHelper.CopyNodeToArray(iterator);

            var pids = Array.ConvertAll(xItems, item => item.Value);

            return(DictionaryHelper.Distinct(pids));
        }