From: Christiaan H. <cmh...@gm...> - 2006-12-31 15:28:30
|
On 31 Dec 2006, at 4:02 PM, Adam R. Maxwell wrote: > I should have documented stuff better, but that encoding actually > shouldn't be passed to the connection object; it was intended for use > in interpreting the records, either as fallback encoding or by > creating a key with the appropriate conversion embedded. > Removed that. > I think we should probably just let the ZOOM_connection autonegotiate > encoding/charset, since those options don't seem to affect the records > themselves. > > Also, since there are multiple flavors of XML (of which DC seems the > least common), explicitly specifying the parser class per-server seems > like the only way to do it reliably. We can get MARCXML from many of > the servers, but it's completely different (and not detected by the > MARC parser). I'm not familiar enough with XML to know the best way > to differentiate between the two in code; using a regex to look for > tags doesn't seem very reliable. > > Adam > Does "xml" syntax mean "any kind of XML"? That's rather useless. Isn't there an option for DC XML? What does the MARCXML look like? Is it very different from the examples in http://www.loc.gov/standards/ marcxml ? I also didn't try if UKMARC is recognized by us, it looks very much the same (I haven't found any difference yet). But anyway, UKMARC is being replaced by USMARC (almost) everywhere. I found some list of SUTRS tags at http://www.bids.ac.uk/info/z3950/ ibss_z3950.htm. But this seems to be incompatible with the example in http://epub.mimas.ac.uk/papers/macappslwow4_full.html. Still no luck finding any definition of the format (short from that it's an "InternationalString"). Christiaan > On Dec 31, 2006, at 03:25, ho...@us... wrote: > >> Revision: 8971 >> http://svn.sourceforge.net/bibdesk/?rev=8971&view=rev >> Author: hofman >> Date: 2006-12-31 03:25:40 -0800 (Sun, 31 Dec 2006) >> >> Log Message: >> ----------- >> Guess parser from record syntax. Pass all options from serverInfo to >> connection. >> >> Modified Paths: >> -------------- >> trunk/bibdesk/BDSKZoomGroupServer.m >> trunk/bibdesk/SearchGroupServers.plist >> >> Modified: trunk/bibdesk/BDSKZoomGroupServer.m >> =================================================================== >> --- trunk/bibdesk/BDSKZoomGroupServer.m 2006-12-31 11:06:05 UTC (rev >> 8970) >> +++ trunk/bibdesk/BDSKZoomGroupServer.m 2006-12-31 11:25:40 UTC (rev >> 8971) >> @@ -9,6 +9,8 @@ >> #import "BDSKZoomGroupServer.h" >> #import "BDSKSearchGroup.h" >> #import "BDSKStringParser.h" >> +#import "BDSKMARCParser.h" >> +#import "BDSKDublinCoreXMLParser.h" >> #import "BDSKServerInfo.h" >> #import "BibItem.h" >> >> @@ -143,10 +145,10 @@ >> [connection setOption:[info password] >> forKey:@"password"]; >> if ([NSString isEmptyString:[info username]] == NO) >> [connection setOption:[info username] forKey:@"user"]; >> - if ([info >> valueForKeyPath:@"options.preferredRecordSyntax"]) { >> - [connection setOption:[info >> valueForKeyPath:@"options.preferredRecordSyntax"] >> - forKey:@"preferredRecordSyntax"]; >> - } >> + NSEnumerator *keyEnum = [[info options] keyEnumerator]; >> + NSString *key; >> + while (key = [keyEnum nextObject]) >> + [connection setOption:[[info options] objectForKey:key] >> forKey:key]; >> OSAtomicCompareAndSwap32Barrier(1, 0, (int32_t >> *)&flags.needsReset); >> }else { >> connection = nil; >> @@ -165,8 +167,15 @@ >> >> - (Class)parserClass >> { >> - NSString *parserClassName = [[[self serverInfo] options] >> objectForKey:@"parserClass"]; >> - return nil == parserClassName ? [BDSKStringParser class] : >> NSClassFromString(parserClassName); >> + NSString *preferredRecordSyntax = [[serverInfo options] >> objectForKey:@"preferredRecordSyntax"]; >> + Class parserClass = Nil; >> + if([preferredRecordSyntax isEqualToString:[BDSKZoomRecord >> stringWithSyntaxType:USMARC]] || [preferredRecordSyntax >> isEqualToString:[BDSKZoomRecord stringWithSyntaxType:UKMARC]]) >> + parserClass = [BDSKDublinCoreXMLParser class]; >> + else if([preferredRecordSyntax isEqualToString:[BDSKZoomRecord >> stringWithSyntaxType:XML]]) >> + parserClass = [BDSKMARCParser class]; >> + else >> + parserClass = [BDSKStringParser class]; >> + return parserClass; >> } >> >> - (oneway void)downloadWithSearchTerm:(NSString *)searchTerm; >> >> Modified: trunk/bibdesk/SearchGroupServers.plist >> =================================================================== >> --- trunk/bibdesk/SearchGroupServers.plist 2006-12-31 11:06:05 UTC >> (rev 8970) >> +++ trunk/bibdesk/SearchGroupServers.plist 2006-12-31 11:25:40 UTC >> (rev 8971) >> @@ -24,8 +24,7 @@ >> port = "7090"; >> options = { >> preferredRecordSyntax = "usmarc"; >> - recordCharset = "marc-8"; >> - parserClass = "BDSKMARCParser"; >> + charset = "marc-8"; >> }; >> }, >> /* USC z39.50 connection */ >> @@ -36,8 +35,7 @@ >> port = "2200"; >> options = { >> preferredRecordSyntax = "usmarc"; >> - recordCharset = "marc-8"; >> - parserClass = "BDSKMARCParser"; >> + charset = "marc-8"; >> }; >> }, >> /* COPAC z39.50 connection */ >> @@ -48,8 +46,7 @@ >> port = "2100"; >> options = { >> preferredRecordSyntax = "xml"; >> - recordCharset = "iso-8859-1"; >> - parserClass = "BDSKDublinCoreXMLParser"; >> + charset = "iso-8859-1"; >> }; >> } >> ) >> >> >> This was sent by the SourceForge.net collaborative development >> platform, the world's largest Open Source development site. >> >> --------------------------------------------------------------------- >> ---- >> Take Surveys. Earn Cash. Influence the Future of IT >> Join SourceForge.net's Techsay panel and you'll get the chance to >> share your >> opinions on IT & business topics through brief surveys - and earn >> cash >> http://www.techsay.com/default.php? >> page=join.php&p=sourceforge&CID=DEVDEV >> _______________________________________________ >> Bibdesk-commit mailing list >> Bib...@li... >> https://lists.sourceforge.net/lists/listinfo/bibdesk-commit > > > ---------------------------------------------------------------------- > --- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to > share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php? > page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Bibdesk-develop mailing list > Bib...@li... > https://lists.sourceforge.net/lists/listinfo/bibdesk-develop |