@@ -5,18 +5,18 @@ @implementation DDXMLElement (DDAdditions)
5
5
/* *
6
6
* Quick method to create an element
7
7
**/
8
- + (DDXMLElement *)dd_elementWithName : (NSString *)name xmlns : (NSString *)ns
8
+ + (DDXMLElement *)elementWithName : (NSString *)name xmlns : (NSString *)ns
9
9
{
10
10
DDXMLElement *element = [DDXMLElement elementWithName: name];
11
- element. dd_xmlns = ns ;
11
+ [ element setXmlns: ns] ;
12
12
return element;
13
13
}
14
14
15
15
/* *
16
16
* This method returns the first child element for the given name.
17
17
* If no child element exists for the given name, returns nil.
18
18
**/
19
- - (DDXMLElement *)dd_elementForName : (NSString *)name
19
+ - (DDXMLElement *)elementForName : (NSString *)name
20
20
{
21
21
NSArray *elements = [self elementsForName: name];
22
22
if ([elements count ] > 0 )
@@ -54,7 +54,7 @@ - (DDXMLElement *)dd_elementForName:(NSString *)name
54
54
* This method returns the first child element for the given name and given xmlns.
55
55
* If no child elements exist for the given name and given xmlns, returns nil.
56
56
**/
57
- - (DDXMLElement *)dd_elementForName : (NSString *)name xmlns : (NSString *)xmlns
57
+ - (DDXMLElement *)elementForName : (NSString *)name xmlns : (NSString *)xmlns
58
58
{
59
59
NSArray *elements = [self elementsForLocalName: name URI: xmlns];
60
60
if ([elements count ] > 0 )
@@ -71,12 +71,12 @@ - (DDXMLElement *)dd_elementForName:(NSString *)name xmlns:(NSString *)xmlns
71
71
* Returns the common xmlns "attribute", which is only accessible via the namespace methods.
72
72
* The xmlns value is often used in jabber elements.
73
73
**/
74
- - (NSString *)dd_xmlns
74
+ - (NSString *)xmlns
75
75
{
76
76
return [[self namespaceForPrefix: @" " ] stringValue ];
77
77
}
78
78
79
- - (void )setDd_xmlns : (NSString *)ns
79
+ - (void )setXmlns : (NSString *)ns
80
80
{
81
81
// If you use setURI: then the xmlns won't be displayed in the XMLString.
82
82
// Adding the namespace this way works properly.
@@ -89,31 +89,31 @@ - (void)setDd_xmlns:(NSString *)ns
89
89
/* *
90
90
* Shortcut to get a pretty (formatted) string representation of the element.
91
91
**/
92
- - (NSString *)dd_prettyXMLString
92
+ - (NSString *)prettyXMLString
93
93
{
94
94
return [self XMLStringWithOptions: (DDXMLNodePrettyPrint | DDXMLNodeCompactEmptyElement)];
95
95
}
96
96
97
97
/* *
98
98
* Shortcut to get a compact string representation of the element.
99
99
**/
100
- - (NSString *)dd_compactXMLString
100
+ - (NSString *)compactXMLString
101
101
{
102
102
return [self XMLStringWithOptions: DDXMLNodeCompactEmptyElement];
103
103
}
104
104
105
105
/* *
106
106
* Shortcut to avoid having to manually create a DDXMLNode everytime.
107
107
**/
108
- - (void )dd_addAttributeWithName : (NSString *)name stringValue : (NSString *)string
108
+ - (void )addAttributeWithName : (NSString *)name stringValue : (NSString *)string
109
109
{
110
110
[self addAttribute: [DDXMLNode attributeWithName: name stringValue: string]];
111
111
}
112
112
113
113
/* *
114
114
* Returns all the attributes as a dictionary.
115
115
**/
116
- - (NSDictionary *)dd_attributesAsDictionary
116
+ - (NSDictionary *)attributesAsDictionary
117
117
{
118
118
NSArray *attributes = [self attributes ];
119
119
NSMutableDictionary *result = [NSMutableDictionary dictionaryWithCapacity: [attributes count ]];
@@ -129,43 +129,3 @@ - (NSDictionary *)dd_attributesAsDictionary
129
129
}
130
130
131
131
@end
132
-
133
- @implementation DDXMLElement (DDAdditionsDeprecated)
134
-
135
- + (nullable DDXMLElement *)elementWithName : (NSString *)name xmlns : (NSString *)ns {
136
- return [self dd_elementWithName: name xmlns: ns];
137
- }
138
-
139
- - (nullable DDXMLElement *)elementForName : (NSString *)name {
140
- return [self dd_elementForName: name];
141
- }
142
-
143
- - (nullable DDXMLElement *)elementForName : (NSString *)name xmlns : (NSString *)xmlns {
144
- return [self dd_elementForName: name xmlns: xmlns];
145
- }
146
-
147
- - (nullable NSString *)xmlns {
148
- return [self dd_xmlns ];
149
- }
150
-
151
- - (void )setXmlns : (NSString *)ns {
152
- [self setDd_xmlns: ns];
153
- }
154
-
155
- - (NSString *)prettyXMLString {
156
- return [self dd_prettyXMLString ];
157
- }
158
-
159
- - (NSString *)compactXMLString {
160
- return [self dd_compactXMLString ];
161
- }
162
-
163
- - (void )addAttributeWithName : (NSString *)name stringValue : (NSString *)string {
164
- return [self dd_addAttributeWithName: name stringValue: string];
165
- }
166
-
167
- - (NSDictionary <NSString*,NSString*> *)attributesAsDictionary {
168
- return [self dd_attributesAsDictionary ];
169
- }
170
-
171
- @end
0 commit comments