Revision: 22520
          http://sourceforge.net/p/bibdesk/svn/22520
Author:   hofman
Date:     2018-08-24 09:08:53 +0000 (Fri, 24 Aug 2018)
Log Message:
-----------
rename and add local variable for nodes

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

Modified: trunk/bibdesk/BDSKArxivParser.m
===================================================================
--- trunk/bibdesk/BDSKArxivParser.m     2018-08-24 06:30:28 UTC (rev 22519)
+++ trunk/bibdesk/BDSKArxivParser.m     2018-08-24 09:08:53 UTC (rev 22520)
@@ -164,17 +164,17 @@
         NSString *string = nil;
         NSArray *nodes;
         DOMNode *node;
-        DOMNode *arxivNode;
+        DOMNode *arxivLinkNode = arxivSearchResult;
+        DOMNode *arxivMetaNode = arxivSearchResult;
         
-        // fetch the arxiv links
-        if (arxivLinkNodePath) {
-            arxivNode = [arxivSearchResult 
singleNodeForXPathExpression:arxivLinkNodePath];
-        } else {
-            arxivNode = arxivSearchResult;
-        }
+        if (arxivLinkNodePath)
+            arxivLinkNode = [arxivSearchResult 
singleNodeForXPathExpression:arxivLinkNodePath];
         
+        if (arxivMetaNodePath)
+            arxivMetaNode = [arxivSearchResult 
singleNodeForXPathExpression:arxivMetaNodePath];
+        
         // search for arXiv ID
-        node = [arxivNode singleNodeForXPathExpression:arxivIDNodePath];
+        node = [arxivLinkNode singleNodeForXPathExpression:arxivIDNodePath];
         if (node) {
             if ((string = [node stringValue])) {
                 if ([string hasCaseInsensitivePrefix:@"arXiv:"])
@@ -192,7 +192,7 @@
         }
         
         // search for PDF
-        node = [arxivNode singleNodeForXPathExpression:pdfURLNodePath];
+        node = [arxivLinkNode singleNodeForXPathExpression:pdfURLNodePath];
         if (node) {
             // successfully found the result PDF url
             if ((string = [(DOMElement *)node getAttribute:@"href"])) {
@@ -206,7 +206,7 @@
         }
         
         // search for DOI
-        node = [arxivNode singleNodeForXPathExpression:doiNodePath];
+        node = [arxivLinkNode singleNodeForXPathExpression:doiNodePath];
         if (node) {
             // successfully found the result PDF url
             if ((string = [node stringValue])) {
@@ -214,14 +214,8 @@
             }
         }
         
-        if (arxivMetaNodePath) {
-            arxivNode = [arxivSearchResult 
singleNodeForXPathExpression:arxivMetaNodePath];
-        } else {
-            arxivNode = arxivSearchResult;
-        }
-        
         // search for title
-        node = [arxivNode singleNodeForXPathExpression:titleNodePath];
+        node = [arxivMetaNode singleNodeForXPathExpression:titleNodePath];
         if (node) {
             if ((string = [node stringValue])) {
                 [pubFields setValue:string forKey:BDSKTitleString];
@@ -229,7 +223,7 @@
         }
         
         // search for authors
-        nodes = [arxivNode nodesForXPathExpression:authorsNodePath];
+        nodes = [arxivMetaNode nodesForXPathExpression:authorsNodePath];
         if (0 < [nodes count]) {
             if ((string = [[nodes valueForKeyPath:@"stringValue"] 
componentsJoinedByString:@" and "])) {
                 [pubFields setValue:string forKey:BDSKAuthorString];
@@ -237,7 +231,7 @@
         }
         
         // search for journal ref
-        node = [arxivNode singleNodeForXPathExpression:journalNodePath];
+        node = [arxivMetaNode singleNodeForXPathExpression:journalNodePath];
         if (node) {
             if ((string = [node stringValue])) {
                 // try to get full journal ref components, as "Journal Volume 
(Year) Pages"
@@ -267,7 +261,7 @@
         }
         
         // search for abstract
-        node = [arxivNode singleNodeForXPathExpression:abstractNodePath];
+        node = [arxivMetaNode singleNodeForXPathExpression:abstractNodePath];
         if (node) {
             if ((string = [node stringValuePreservingBreaks])) {
                 if (isAbstract && [string hasPrefix:@"Abstract: "])

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


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to