ObjFW  Diff

Differences From Artifact [d1aca2d059]:

To Artifact [ea560ddced]:


24
25
26
27
28
29
30
31
32

33
34
35
36



37
38
39
40

41
42
43
44

45
46
47
48
49
50
51
24
25
26
27
28
29
30


31




32
33
34
35
36
37

38


39

40
41
42
43
44
45
46
47







-
-
+
-
-
-
-
+
+
+



-
+
-
-

-
+







@class OFXMLAttribute;

/*!
 * @brief A class which stores an XML element.
 */
@interface OFXMLElement: OFXMLNode
{
	OFString *name;
	OFString *ns;
	OFString *_name, *_namespace, *_defaultNamespace;
	OFString *defaultNamespace;
	OFMutableArray *attributes;
	OFMutableDictionary *namespaces;
	OFMutableArray *children;
	OFMutableArray *_attributes;
	OFMutableDictionary *_namespaces;
	OFMutableArray *_children;
}

#ifdef OF_HAVE_PROPERTIES
@property (copy) OFString *name;
@property (copy) OFString *name, *namespace, *defaultNamespace;
@property (copy, getter=namespace, setter=setNamespace:) OFString *ns;
@property (copy) OFString *defaultNamespace;
@property (readonly, copy) OFArray *attributes;
@property (readonly, copy) OFArray *children;
@property (copy) OFArray *children;
#endif

/*!
 * @brief Creates a new XML element with the specified name.
 *
 * @param name The name for the element
 * @return A new autoreleased OFXMLElement with the specified element name
63
64
65
66
67
68
69
70

71
72
73
74
75

76
77
78
79
80
81
82

83
84
85
86
87
88

89
90
91
92
93
94
95
59
60
61
62
63
64
65

66
67
68
69
70

71
72
73
74
75
76
77

78
79
80
81
82
83

84
85
86
87
88
89
90
91







-
+




-
+






-
+





-
+







+ (instancetype)elementWithName: (OFString*)name
		    stringValue: (OFString*)stringValue;

/*!
 * @brief Creates a new XML element with the specified name and namespace.
 *
 * @param name The name for the element
 * @param ns The namespace for the element
 * @param namespace The namespace for the element
 * @return A new autoreleased OFXMLElement with the specified element name and
 *	   namespace
 */
+ (instancetype)elementWithName: (OFString*)name
		      namespace: (OFString*)ns;
		      namespace: (OFString*)namespace;

/*!
 * @brief Creates a new XML element with the specified name, namespace and
 * 	  string value.
 *
 * @param name The name for the element
 * @param ns The namespace for the element
 * @param namespace The namespace for the element
 * @param stringValue The value for the element
 * @return A new autoreleased OFXMLElement with the specified element name,
 *	   namespace and value
 */
+ (instancetype)elementWithName: (OFString*)name
		      namespace: (OFString*)ns
		      namespace: (OFString*)namespace
		    stringValue: (OFString*)stringValue;

/*!
 * @brief Creates a new element with the specified element.
 *
 * @param element An OFXMLElement to initialize the OFXMLElement with
 * @return A new autoreleased OFXMLElement with the contents of the specified
135
136
137
138
139
140
141
142

143
144
145
146
147

148
149
150
151
152
153
154

155
156
157
158
159
160

161
162
163
164
165
166
167
131
132
133
134
135
136
137

138
139
140
141
142

143
144
145
146
147
148
149

150
151
152
153
154
155

156
157
158
159
160
161
162
163







-
+




-
+






-
+





-
+







   stringValue: (OFString*)stringValue;

/*!
 * @brief Initializes an already allocated OFXMLElement with the specified name
 *	  and namespace.
 *
 * @param name The name for the element
 * @param ns The namespace for the element
 * @param namespace The namespace for the element
 * @return An initialized OFXMLElement with the specified element name and
 *	   namespace
 */
- initWithName: (OFString*)name
     namespace: (OFString*)ns;
     namespace: (OFString*)namespace;

/*!
 * @brief Initializes an already allocated OFXMLElement with the specified name,
 *	  namespace and value.
 *
 * @param name The name for the element
 * @param ns The namespace for the element
 * @param namespace The namespace for the element
 * @param stringValue The value for the element
 * @return An initialized OFXMLElement with the specified element name,
 *	   namespace and value
 */
- initWithName: (OFString*)name
     namespace: (OFString*)ns
     namespace: (OFString*)namespace
   stringValue: (OFString*)stringValue;

/*!
 * @brief Initializes an already allocated OFXMLElement with the specified
 *	  element.
 *
 * @param element An OFXMLElement to initialize the OFXMLElement with
201
202
203
204
205
206
207
208

209
210

211
212
213
214
215
216
217
197
198
199
200
201
202
203

204
205

206
207
208
209
210
211
212
213







-
+

-
+







 * @return The name of the element
 */
- (OFString*)name;

/*!
 * @brief Sets the namespace of the element.
 *
 * @param ns The new namespace
 * @param namespace The new namespace
 */
- (void)setNamespace: (OFString*)ns;
- (void)setNamespace: (OFString*)namespace;

/*!
 * @brief Returns the namespace of the element.
 *
 * @return The namespace of the element
 */
- (OFString*)namespace;
271
272
273
274
275
276
277
278

279
280
281
282

283
284
285
286
287
288
289
267
268
269
270
271
272
273

274
275
276
277

278
279
280
281
282
283
284
285







-
+



-
+







 * @brief Adds the specified attribute with the specified namespace and string
 *	  value.
 *
 * If an attribute with the same name and namespace already exists, it is not
 * added.
 *
 * @param name The name of the attribute
 * @param ns The namespace of the attribute
 * @param namespace The namespace of the attribute
 * @param stringValue The value of the attribute
 */
- (void)addAttributeWithName: (OFString*)name
		   namespace: (OFString*)ns
		   namespace: (OFString*)namespace
		 stringValue: (OFString*)stringValue;

/*!
 * @brief Returns the attribute with the specified name.
 *
 * @param attributeName The name of the attribute
 * @return The attribute with the specified name
316
317
318
319
320
321
322
323

324
325
326

327
328
329
330
331
332

333
334
335

336
337
338
339
340
341

342
343

344
345
346
347
348
349
350
312
313
314
315
316
317
318

319
320
321

322
323
324
325
326
327

328
329
330

331
332
333
334
335
336

337
338

339
340
341
342
343
344
345
346







-
+


-
+





-
+


-
+





-
+

-
+







- (void)removeAttributeForName: (OFString*)attributeName
		     namespace: (OFString*)attributeNS;

/*!
 * @brief Sets a prefix for a namespace.
 *
 * @param prefix The prefix for the namespace
 * @param ns The namespace for which the prefix is set
 * @param namespace The namespace for which the prefix is set
 */
- (void)setPrefix: (OFString*)prefix
     forNamespace: (OFString*)ns;
     forNamespace: (OFString*)namespace;

/*!
 * @brief Binds a prefix for a namespace.
 *
 * @param prefix The prefix for the namespace
 * @param ns The namespace for which the prefix is bound
 * @param namespace The namespace for which the prefix is bound
 */
- (void)bindPrefix: (OFString*)prefix
      forNamespace: (OFString*)ns;
      forNamespace: (OFString*)namespace;

/*!
 * @brief Sets the default namespace for the element to be used if there is no
 *	  parent.
 *
 * @param ns The default namespace for the element
 * @param defaultNamespace The default namespace for the element
 */
- (void)setDefaultNamespace: (OFString*)ns;
- (void)setDefaultNamespace: (OFString*)defaultNamespace;

/*!
 * @brief Adds a child to the OFXMLElement.
 *
 * @param child An OFXMLNode which is added as a child
 */
- (void)addChild: (OFXMLNode*)child;