Revision: 28153
          http://sourceforge.net/p/bibdesk/svn/28153
Author:   hofman
Date:     2022-12-28 15:38:03 +0000 (Wed, 28 Dec 2022)
Log Message:
-----------
simplify canParse method for google scholar parser

Modified Paths:
--------------
    trunk/bibdesk/BDSKGoogleScholarParser.m

Modified: trunk/bibdesk/BDSKGoogleScholarParser.m
===================================================================
--- trunk/bibdesk/BDSKGoogleScholarParser.m     2022-12-28 07:30:25 UTC (rev 
28152)
+++ trunk/bibdesk/BDSKGoogleScholarParser.m     2022-12-28 15:38:03 UTC (rev 
28153)
@@ -46,13 +46,12 @@
 + (BOOL)canParseDocument:(DOMDocument *)domDocument fromURL:(NSURL *)url{
     // !!! other countries end up with e.g. scholar.google.be; checking for 
scholar.google.com may fail in those cases
     // also some sites access google scholar via an ezproxy, so the suffix 
could be quite complex
-    if (nil == [url host] || NO == [[[url host] lowercaseString] 
hasPrefix:@"scholar.google."]){
+    if (NO == [[[url host] lowercaseString] hasPrefix:@"scholar.google."])
         return NO;
-    }
     
-    NSUInteger nodecount = [[[domDocument documentElement] nodesForXPath:[self 
citationNodeXPath]] count];
-
-    return nodecount > 0;
+    DOMNode *node = [[domDocument documentElement] singleNodeForXPath:[self 
citationNodeXPath]];
+    
+    return node != nil;
 }
 
 + (NSString *)name {return @"Google Scholar"; }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to