當前位置: 首頁>>代碼示例>>C#>>正文


C# Author.setinstitute方法代碼示例

本文整理匯總了C#中Author.setinstitute方法的典型用法代碼示例。如果您正苦於以下問題:C# Author.setinstitute方法的具體用法?C# Author.setinstitute怎麽用?C# Author.setinstitute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Author的用法示例。


在下文中一共展示了Author.setinstitute方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: GSParseProfile

        public void GSParseProfile(Uri URL)
        {

            String strResponse = this.GSTryConnect(URL);

            HtmlDocument document = new HtmlDocument();
            document.Load(new StringReader(strResponse));

            String authorName = "";
            String residence = "";
            String interest = "";
            String hindex = "";
            String iindex = "";
            String totalcitations = "";

            this.resultList.resultType = this.query.resultType;
            this.resultList.loadType();

            SearchType type;


            Author author = new Author();
            author.setresArea("");
            author.setstatsGraphUrl(new Uri("http://google.com"));
            author.setinstitute("");





            HtmlNode profileNode = document.DocumentNode.SelectSingleNode("//div[@class='g-section g-tpl-250-alt']//div[@class='g-unit']");
            if (profileNode != null)
            {
                //Console.WriteLine("hey");
                // Console.WriteLine(profileNode.InnerText);
                //   Author author = new Author();
                HtmlNode userInfoNode = profileNode.SelectSingleNode("//div[@class='cit-user-info']//div[@class='g-unit']");

                HtmlNode userNameNode = userInfoNode.SelectSingleNode("//span[@id='cit-name-read']");

                authorName = userNameNode.InnerText;
                author.setname(authorName);

                HtmlNode userResidenceNode = userInfoNode.SelectSingleNode("//span[@id='cit-affiliation-read']");

                residence = userResidenceNode.InnerText;
                author.setinstitute(residence);

                HtmlNode userInterestNode = userInfoNode.SelectSingleNode("//span[@id='cit-int-read']");

                interest = userInterestNode.InnerText;
                author.setresArea(interest);

                Console.WriteLine("Author " + authorName + residence + interest);

                HtmlNode dataNode = profileNode.SelectSingleNode("div[@class='cit-lbb']//table//tr//table[@id='stats']");

                if (dataNode != null)
                {
                    int i = 0;
                    foreach (HtmlNode hindexNode in dataNode.SelectNodes("tr//td[@class='cit-borderleft cit-data']"))
                    {
                        if (i == 0)
                        {
                            totalcitations = hindexNode.InnerText;
                            author.setnumPapers(Convert.ToInt32(totalcitations));
                        }

                        else if (i == 2)
                        {
                            hindex = hindexNode.InnerText;
                            author.sethIndex(Convert.ToInt32(hindex));
                        }

                        else if (i == 4)
                        {
                            iindex = hindexNode.InnerText;
                            author.setiIndex(Convert.ToInt32(iindex));
                        }

                        i++;
                    }

                    HtmlNode imageNode = profileNode.SelectSingleNode("div[@class='cit-lbb']//table//td[@valign='top']//img[@src]");

                    String url = imageNode.Attributes["src"].Value;
                    Console.WriteLine(hindex + "hey " + iindex + "hi" + totalcitations + " " + url);
                    url = System.Net.WebUtility.HtmlDecode(url);
                    var strUrl = new Uri(url);
                    author.setstatsGraphUrl(strUrl);
                    type = author;
                    this.resultList.type = type;



                }

            }
            else
            {
//.........這裏部分代碼省略.........
開發者ID:srinivasans,項目名稱:OpenSoft2013,代碼行數:101,代碼來源:Parser.cs


注:本文中的Author.setinstitute方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。