From 848cf105c4ac3042ee25a27204aede1f21d93300 Mon Sep 17 00:00:00 2001 From: Chris Ballinger Date: Sat, 26 Oct 2019 22:25:39 -0700 Subject: [PATCH] Revert dd_ prefix for additions --- KissXML.podspec | 2 +- KissXML/Additions/DDXMLElementAdditions.h | 38 ++++---------- KissXML/Additions/DDXMLElementAdditions.m | 60 ++++------------------- 3 files changed, 21 insertions(+), 79 deletions(-) diff --git a/KissXML.podspec b/KissXML.podspec index 1ad99fb9..46578090 100644 --- a/KissXML.podspec +++ b/KissXML.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'KissXML' - s.version = '5.3.0' + s.version = '5.3.1' s.license = { :type => 'MIT', :file => 'LICENSE.txt' } s.summary = 'A replacement for Cocoa\'s NSXML cluster of classes. Based on libxml.' s.homepage = 'https://github.com/robbiehanson/KissXML' diff --git a/KissXML/Additions/DDXMLElementAdditions.h b/KissXML/Additions/DDXMLElementAdditions.h index d29fcc8e..b72907a7 100644 --- a/KissXML/Additions/DDXMLElementAdditions.h +++ b/KissXML/Additions/DDXMLElementAdditions.h @@ -7,38 +7,20 @@ NS_ASSUME_NONNULL_BEGIN @interface DDXMLElement (DDAdditions) -+ (nullable DDXMLElement *)dd_elementWithName:(NSString *)name xmlns:(NSString *)ns; ++ (nullable DDXMLElement *)elementWithName:(NSString *)name xmlns:(NSString *)ns; -- (nullable DDXMLElement *)dd_elementForName:(NSString *)name; -- (nullable DDXMLElement *)dd_elementForName:(NSString *)name xmlns:(NSString *)xmlns; +- (nullable DDXMLElement *)elementForName:(NSString *)name; +- (nullable DDXMLElement *)elementForName:(NSString *)name xmlns:(NSString *)xmlns; -@property (nonatomic, readwrite, nullable) NSString *dd_xmlns; +- (nullable NSString *)xmlns; +- (void)setXmlns:(NSString *)ns; -@property (nonatomic, readonly) NSString *dd_prettyXMLString; -@property (nonatomic, readonly) NSString *dd_compactXMLString; +- (NSString *)prettyXMLString; +- (NSString *)compactXMLString; -- (void)dd_addAttributeWithName:(NSString *)name stringValue:(NSString *)string; +- (void)addAttributeWithName:(NSString *)name stringValue:(NSString *)string; -@property (nonatomic, readonly) NSDictionary *dd_attributesAsDictionary; +- (NSDictionary *)attributesAsDictionary; @end - -@interface DDXMLElement (DDAdditionsDeprecated) - -+ (nullable DDXMLElement *)elementWithName:(NSString *)name xmlns:(NSString *)ns DEPRECATED_MSG_ATTRIBUTE("use dd_elementWithName:xmlns: instead."); - -- (nullable DDXMLElement *)elementForName:(NSString *)name DEPRECATED_MSG_ATTRIBUTE("use dd_elementForName: instead."); -- (nullable DDXMLElement *)elementForName:(NSString *)name xmlns:(NSString *)xmlns DEPRECATED_MSG_ATTRIBUTE("use dd_elementForName:xmlns: instead."); - -- (nullable NSString *)xmlns DEPRECATED_MSG_ATTRIBUTE("use dd_xmlns instead."); -- (void)setXmlns:(NSString *)ns DEPRECATED_MSG_ATTRIBUTE("use setDd_xmlns: instead."); - -- (NSString *)prettyXMLString DEPRECATED_MSG_ATTRIBUTE("use dd_prettyXMLString instead."); -- (NSString *)compactXMLString DEPRECATED_MSG_ATTRIBUTE("use dd_compactXMLString instead."); - -- (void)addAttributeWithName:(NSString *)name stringValue:(NSString *)string DEPRECATED_MSG_ATTRIBUTE("use dd_addAttributeWithName:stringValue: instead."); - -- (NSDictionary *)attributesAsDictionary DEPRECATED_MSG_ATTRIBUTE("use dd_attributesAsDictionary instead."); - -@end -NS_ASSUME_NONNULL_END +NS_ASSUME_NONNULL_END \ No newline at end of file diff --git a/KissXML/Additions/DDXMLElementAdditions.m b/KissXML/Additions/DDXMLElementAdditions.m index 36a7e78d..6977bf68 100644 --- a/KissXML/Additions/DDXMLElementAdditions.m +++ b/KissXML/Additions/DDXMLElementAdditions.m @@ -5,10 +5,10 @@ @implementation DDXMLElement (DDAdditions) /** * Quick method to create an element **/ -+ (DDXMLElement *)dd_elementWithName:(NSString *)name xmlns:(NSString *)ns ++ (DDXMLElement *)elementWithName:(NSString *)name xmlns:(NSString *)ns { DDXMLElement *element = [DDXMLElement elementWithName:name]; - element.dd_xmlns = ns; + [element setXmlns:ns]; return element; } @@ -16,7 +16,7 @@ + (DDXMLElement *)dd_elementWithName:(NSString *)name xmlns:(NSString *)ns * This method returns the first child element for the given name. * If no child element exists for the given name, returns nil. **/ -- (DDXMLElement *)dd_elementForName:(NSString *)name +- (DDXMLElement *)elementForName:(NSString *)name { NSArray *elements = [self elementsForName:name]; if([elements count] > 0) @@ -54,7 +54,7 @@ - (DDXMLElement *)dd_elementForName:(NSString *)name * This method returns the first child element for the given name and given xmlns. * If no child elements exist for the given name and given xmlns, returns nil. **/ -- (DDXMLElement *)dd_elementForName:(NSString *)name xmlns:(NSString *)xmlns +- (DDXMLElement *)elementForName:(NSString *)name xmlns:(NSString *)xmlns { NSArray *elements = [self elementsForLocalName:name URI:xmlns]; if([elements count] > 0) @@ -71,12 +71,12 @@ - (DDXMLElement *)dd_elementForName:(NSString *)name xmlns:(NSString *)xmlns * Returns the common xmlns "attribute", which is only accessible via the namespace methods. * The xmlns value is often used in jabber elements. **/ -- (NSString *)dd_xmlns +- (NSString *)xmlns { return [[self namespaceForPrefix:@""] stringValue]; } -- (void)setDd_xmlns:(NSString *)ns +- (void)setXmlns:(NSString *)ns { // If you use setURI: then the xmlns won't be displayed in the XMLString. // Adding the namespace this way works properly. @@ -89,7 +89,7 @@ - (void)setDd_xmlns:(NSString *)ns /** * Shortcut to get a pretty (formatted) string representation of the element. **/ -- (NSString *)dd_prettyXMLString +- (NSString *)prettyXMLString { return [self XMLStringWithOptions:(DDXMLNodePrettyPrint | DDXMLNodeCompactEmptyElement)]; } @@ -97,7 +97,7 @@ - (NSString *)dd_prettyXMLString /** * Shortcut to get a compact string representation of the element. **/ -- (NSString *)dd_compactXMLString +- (NSString *)compactXMLString { return [self XMLStringWithOptions:DDXMLNodeCompactEmptyElement]; } @@ -105,7 +105,7 @@ - (NSString *)dd_compactXMLString /** * Shortcut to avoid having to manually create a DDXMLNode everytime. **/ -- (void)dd_addAttributeWithName:(NSString *)name stringValue:(NSString *)string +- (void)addAttributeWithName:(NSString *)name stringValue:(NSString *)string { [self addAttribute:[DDXMLNode attributeWithName:name stringValue:string]]; } @@ -113,7 +113,7 @@ - (void)dd_addAttributeWithName:(NSString *)name stringValue:(NSString *)string /** * Returns all the attributes as a dictionary. **/ -- (NSDictionary *)dd_attributesAsDictionary +- (NSDictionary *)attributesAsDictionary { NSArray *attributes = [self attributes]; NSMutableDictionary *result = [NSMutableDictionary dictionaryWithCapacity:[attributes count]]; @@ -129,43 +129,3 @@ - (NSDictionary *)dd_attributesAsDictionary } @end - -@implementation DDXMLElement (DDAdditionsDeprecated) - -+ (nullable DDXMLElement *)elementWithName:(NSString *)name xmlns:(NSString *)ns { - return [self dd_elementWithName:name xmlns:ns]; -} - -- (nullable DDXMLElement *)elementForName:(NSString *)name { - return [self dd_elementForName:name]; -} - -- (nullable DDXMLElement *)elementForName:(NSString *)name xmlns:(NSString *)xmlns { - return [self dd_elementForName:name xmlns:xmlns]; -} - -- (nullable NSString *)xmlns { - return [self dd_xmlns]; -} - -- (void)setXmlns:(NSString *)ns { - [self setDd_xmlns:ns]; -} - -- (NSString *)prettyXMLString { - return [self dd_prettyXMLString]; -} - -- (NSString *)compactXMLString { - return [self dd_compactXMLString]; -} - -- (void)addAttributeWithName:(NSString *)name stringValue:(NSString *)string { - return [self dd_addAttributeWithName:name stringValue:string]; -} - -- (NSDictionary *)attributesAsDictionary { - return [self dd_attributesAsDictionary]; -} - -@end