Revision: 22556
http://sourceforge.net/p/bibdesk/svn/22556
Author: hofman
Date: 2018-09-03 21:58:23 +0000 (Mon, 03 Sep 2018)
Log Message:
-----------
remove unused methods
Modified Paths:
--------------
trunk/bibdesk/NSXMLNode_BDSKExtensions.h
trunk/bibdesk/NSXMLNode_BDSKExtensions.m
Modified: trunk/bibdesk/NSXMLNode_BDSKExtensions.h
===================================================================
--- trunk/bibdesk/NSXMLNode_BDSKExtensions.h 2018-09-03 21:53:35 UTC (rev
22555)
+++ trunk/bibdesk/NSXMLNode_BDSKExtensions.h 2018-09-03 21:58:23 UTC (rev
22556)
@@ -40,12 +40,7 @@
@interface NSXMLNode (BDSKExtensions)
+
- (NSString *)stringValueOfAttribute:(NSString *)attrName;
-- (NSArray *)descendantOrSelfNodesWithClassName:(NSString *)className
error:(NSError **)err;
-- (BOOL)hasParentWithClassName:(NSString *)class;
-- (NSArray *)classNames;
-- (NSString *)fullStringValueIfABBR;
-- (NSString *)searchXPath:(NSString *)searchPath addTo:(NSMutableDictionary
*)dict forKey:(NSString *)key;
-- (NSString *)searchXPath:(NSString *)searchPath addTo:(NSMutableDictionary
*)dict forKey:(NSString *)key last:(BOOL)last;
@end
Modified: trunk/bibdesk/NSXMLNode_BDSKExtensions.m
===================================================================
--- trunk/bibdesk/NSXMLNode_BDSKExtensions.m 2018-09-03 21:53:35 UTC (rev
22555)
+++ trunk/bibdesk/NSXMLNode_BDSKExtensions.m 2018-09-03 21:58:23 UTC (rev
22556)
@@ -42,104 +42,9 @@
@implementation NSXMLNode (BDSKExtensions)
- (NSString *)stringValueOfAttribute:(NSString *)attrName{
- NSError *err = nil;
- NSString *path = [NSString stringWithFormat:@"./@%@", attrName];
- NSArray *atts = [self nodesForXPath:path error:&err];
- if ([atts count] == 0) return nil;
- return [[atts objectAtIndex:0] stringValue];
+ if ([self kind] != NSXMLElementKind)
+ return nil;
+ return [[(NSXMLElement *)self attributeForName:attrName] stringValue];
}
-- (NSArray *)descendantOrSelfNodesWithClassName:(NSString *)className
error:(NSError **)err{
- NSString *path = [NSString stringWithFormat:@".//*[contains(concat(' ',
normalize-space(@class), ' '), ' %@ ')]", className];
- NSArray *ar = [self nodesForXPath:path error:err];
- return ar;
-}
-
-- (BOOL)hasParentWithClassName:(NSString *)class{
-
- NSXMLNode *parent = [self parent];
-
- do{
- if([parent kind] != NSXMLElementKind) return NO; // handles root node
-
- NSArray *parentClassNames = [parent classNames];
-
- if ([parentClassNames containsObject:class]){
- return YES;
- }
-
- }while(parent = [parent parent]);
-
- return NO;
-}
-
-
-- (NSArray *)classNames{
-
- if([self kind] != NSXMLElementKind) [NSException
raise:NSInvalidArgumentException format:@"wrong node kind"];
-
- NSMutableArray *a = [NSMutableArray arrayWithCapacity:0];
-
- NSError *err = nil;
-
- NSArray *classNodes = [self nodesForXPath:@"@class"
- error:&err];
- if([classNodes count] == 0)
- return a;
-
- NSAssert ([classNodes count] == 1, @"too many nodes in classNodes");
-
- NSXMLNode *classNode = [classNodes objectAtIndex:0];
-
- [a addObjectsFromArray:[[classNode stringValue]
componentsSeparatedByString:@" "]];
-
- return a;
-}
-
-
-- (NSString *)fullStringValueIfABBR{
- NSError *err;
- if([self kind] != NSXMLElementKind) [NSException
raise:NSInvalidArgumentException format:@"wrong node kind"];
-
- if([[self name] isEqualToString:@"abbr"]){
- //todo: will need more robust comparison for namespaced node titles.
-
- // return value of title attribute instead
- NSArray *titleNodes = [self nodesForXPath:@"@title"
- error:&err];
- if([titleNodes count] > 0){
- return [[titleNodes objectAtIndex:0] stringValue];
- }
- }
-
- return [self stringValue];
-}
-
-- (NSString *)searchXPath:(NSString *)searchPath addTo:(NSMutableDictionary
*)dict forKey:(NSString *)key {
- return [self searchXPath:searchPath
- addTo:dict
- forKey:key
- last:NO];
-}
-
-- (NSString *)searchXPath:(NSString *)searchPath addTo:(NSMutableDictionary
*)dict forKey:(NSString *)key last:(BOOL)last {
- NSError *error = nil;
- NSArray *nodes = [self nodesForXPath:searchPath error:&error];
- NSString *string = nil;
- if (nil != nodes && 0 < [nodes count]) {
- if (last) {
- string = [[nodes objectAtIndex:([nodes count] - 1)]
stringValue];
- } else {
- string = [[nodes objectAtIndex:0] stringValue];
- }
- if (string) {
- string = [string
stringByRemovingSurroundingWhitespaceAndNewlines];
- if (dict != nil) {
- [dict setValue:string forKey:key];
- }
- }
- }
- return string;
-}
-
@end
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