public bool returnJournalNext(ref Journal journ) { HtmlNode mainTable = CiteDoc.DocumentNode.SelectSingleNode("//*[@id=\"result_list\"]"); HtmlNode entryNoNode, paperNode, authorNode, journalNode, yearNode, citationNode; string paperName, authorName, journalName, publishYear, noCitations, citationLink, paperURL; int citno; if (noResult == 0) return false; if (CiteDoc.DocumentNode.SelectSingleNode("//*[@id=\"result_list\"]") == null) return false; mainTable = CiteDoc.DocumentNode.SelectSingleNode("//*[@id=\"result_list\"]"); for (int i = 1; i <= 10; i++) { entryNoNode = mainTable.SelectSingleNode("div[" + i + "]"); if (entryNoNode == null) break; paperURL = ""; paperNode = entryNoNode.SelectSingleNode("h3/a"); if (paperNode == null) { paperNode = entryNoNode.SelectSingleNode("h3/span"); paperName = paperNode.InnerText; paperName = paperName.Substring(37); } else { paperName = paperNode.InnerText.Substring(19); if (paperNode.Attributes["href"] != null) paperURL = "http://citeseer.ist.psu.edu" + paperNode.Attributes["href"].Value; } //Console.WriteLine(paperName); //Now remove unwanted preceding character and spaces from paperName authorNode = entryNoNode.SelectSingleNode("div[1]/span[1]"); authorName = authorNode.InnerText; authorName = authorName.Substring(22); //Now remove unwanted preceding character and spaces from authorName if (entryNoNode.SelectSingleNode("div[1]/span[3]") == null) { journalName = ""; yearNode = entryNoNode.SelectSingleNode("div[1]/span[2]"); if (yearNode == null) publishYear = "0"; else { publishYear = yearNode.InnerText; publishYear = publishYear.Substring(2); } } else { journalNode = entryNoNode.SelectSingleNode("div[1]/span[2]"); journalName = journalNode.InnerText; journalName = journalName.Substring(2); yearNode = entryNoNode.SelectSingleNode("div[1]/span[3]"); publishYear = yearNode.InnerText; publishYear = publishYear.Substring(2); } //Process publishYear and journalNode to get important data citationNode = entryNoNode.SelectSingleNode("div[3]/a"); if (citationNode.InnerText == "Abstract") citationNode = entryNoNode.SelectSingleNode("div[3]/a[2]"); noCitations = citationNode.InnerText; //remove unnecessary details from the number of citations noCitations = noCitations.Substring(9); // Console.WriteLine(noCitations); if (citationNode.Attributes["href"] == null) citationLink = ""; else citationLink = "http://citeseer.ist.psu.edu" + citationNode.Attributes["href"].Value; citno = 0; if (noCitations[0] != 't') for (int j = 0; noCitations[j] != ' '; j++) { citno = citno * 10 + Convert.ToInt32(noCitations[j]) - 48; } //Now the processed strings are to be entered on the type of author int year; try { year = Convert.ToInt32(publishYear); } catch (Exception e) { year = 0; } Paper paper1 = new Paper(paperName, paperURL, authorName, year, journalName, "", citno, citationLink, (PageNo - 1) * 10 + i); journ.addPaper(paper1); } int check = LoadNextPage(); if (check == 1) return true; else return false; }
public SG.Journal getJournals(string journalName, string ISSN, string keywords, int noResults = 20) { Request requestJournal = new Request(); requestJournal.AppID = "c49b4e59-08dd-4f27-a53b-53cc72f169af"; //Response response; SG.Journal journ = new SG.Journal(journalName); requestJournal.ResultObjects = ObjectType.Publication; requestJournal.JournalQuery = journalName; //requestJournal.FulltextQuery = keywords; requestJournal.StartIdx = 1; requestJournal.EndIdx = 20; List<SG.Paper> papers = generatePaper(requestJournal, 20); for (int i = 0; i < papers.Count; i++) { journ.addPaper(papers[i]); } return journ; }