Revision: 18406
          http://bibdesk.svn.sourceforge.net/bibdesk/?rev=18406&view=rev
Author:   hofman
Date:     2012-01-15 16:44:42 +0000 (Sun, 15 Jan 2012)
Log Message:
-----------
check first for a different link in MAS output, because the main item is not 
listed the same way

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

Modified: trunk/bibdesk/BDSKMASParser.m
===================================================================
--- trunk/bibdesk/BDSKMASParser.m       2012-01-15 12:30:18 UTC (rev 18405)
+++ trunk/bibdesk/BDSKMASParser.m       2012-01-15 16:44:42 UTC (rev 18406)
@@ -52,11 +52,13 @@
         return NO;
     
     NSError *error;
-    NSArray *nodes = [xmlDocument 
nodesForXPath:@".//a[starts-with(@href,'Publication/')]" error:&error];
+    NSArray *nodes = [xmlDocument 
nodesForXPath:@".//a[starts-with(@href,'../../UserInput/EditPublication?id=')]" 
error:&error];
+    if ([nodes count] == 0) {
+        nodes = [xmlDocument 
nodesForXPath:@".//a[starts-with(@href,'Publication/')]" error:&error];
+        if ([nodes count] == 0)
+            nodes = [xmlDocument 
nodesForXPath:@".//a[starts-with(@href,'/Publication/')]" error:&error];
+    }
     
-    if ([nodes count] == 0)
-        nodes = [xmlDocument 
nodesForXPath:@".//a[starts-with(@href,'/Publication/')]" error:&error];
-    
     return [nodes count] > 0;
 }
 
@@ -66,23 +68,30 @@
        
        NSError *error = nil;
 
-    NSArray *nodes = [xmlDocument 
nodesForXPath:@".//a[starts-with(@href,'Publication/')]" error:&error];
+    NSArray *nodes = [xmlDocument 
nodesForXPath:@".//a[starts-with(@href,'../../UserInput/EditPublication?id=')]" 
error:&error];
     
     if ([nodes count] == 0) {
         nodes = [xmlDocument 
nodesForXPath:@".//a[starts-with(@href,'/Publication/')]" error:&error];
         if ([nodes count] == 0) {
-            if (outError) *outError = error;
-            return nil;
+            nodes = [xmlDocument 
nodesForXPath:@".//a[starts-with(@href,'/Publication/')]" error:&error];
+            if ([nodes count] == 0) {
+                if (outError) *outError = error;
+                return nil;
+            }
         }
     }
     
     for (NSXMLNode *node in nodes) {
         NSString *href = [node stringValueOfAttribute:@"href"];
         
-        AGRegex *idRegex = [AGRegex 
regexWithPattern:@"^/?Publication/([0-9]*)/"];
+        AGRegex *idRegex = [AGRegex 
regexWithPattern:@"^\\.\\./\\.\\./UserInput/EditPublication\\?id\\=([0-9]*)$"];
         AGRegexMatch *match = [idRegex findInString:href];
-        if ([match count] != 2)
-            continue;
+        if ([match count] != 2) {
+            idRegex = [AGRegex regexWithPattern:@"^/?Publication/([0-9]*)/"];
+            match = [idRegex findInString:href];
+            if ([match count] != 2)
+                continue;
+        }
         
         NSString *publicationID = [match groupAtIndex:1];
         

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


------------------------------------------------------------------------------
RSA(R) Conference 2012
Mar 27 - Feb 2
Save $400 by Jan. 27
Register now!
http://p.sf.net/sfu/rsa-sfdev2dev2
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to