ObjFW
 All Classes Functions Variables
OFXMLElement.h
1 /*
2  * Copyright (c) 2008, 2009, 2010, 2011, 2012
3  * Jonathan Schleifer <js@webkeks.org>
4  *
5  * All rights reserved.
6  *
7  * This file is part of ObjFW. It may be distributed under the terms of the
8  * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
9  * the packaging of this file.
10  *
11  * Alternatively, it may be distributed under the terms of the GNU General
12  * Public License, either version 2 or 3, which can be found in the file
13  * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
14  * file.
15  */
16 
17 #import "OFXMLNode.h"
18 
19 @class OFString;
20 @class OFArray;
21 @class OFMutableString;
22 @class OFMutableArray;
23 @class OFMutableDictionary;
24 @class OFXMLAttribute;
25 
30 {
31  OFString *name;
32  OFString *ns;
33  OFString *defaultNamespace;
35  OFMutableDictionary *namespaces;
37 }
38 
39 #ifdef OF_HAVE_PROPERTIES
40 @property (copy) OFString *name;
41 @property (copy, getter=namespace, setter=setNamespace:) OFString *ns;
42 @property (copy) OFString *defaultNamespace;
43 @property (readonly, copy) OFArray *attributes;
44 @property (readonly, copy) OFArray *children;
45 #endif
46 
53 + (instancetype)elementWithName: (OFString*)name;
54 
63 + (instancetype)elementWithName: (OFString*)name
64  stringValue: (OFString*)stringValue;
65 
74 + (instancetype)elementWithName: (OFString*)name
75  namespace: (OFString*)ns;
76 
87 + (instancetype)elementWithName: (OFString*)name
88  namespace: (OFString*)ns
89  stringValue: (OFString*)stringValue;
90 
98 + (instancetype)elementWithElement: (OFXMLElement*)element;
99 
106 + (instancetype)elementWithXMLString: (OFString*)string;
107 
115 + (instancetype)elementWithFile: (OFString*)path;
116 
123 - initWithName: (OFString*)name;
124 
134 - initWithName: (OFString*)name
135  stringValue: (OFString*)stringValue;
136 
146 - initWithName: (OFString*)name
147  namespace: (OFString*)ns;
148 
159 - initWithName: (OFString*)name
160  namespace: (OFString*)ns
161  stringValue: (OFString*)stringValue;
162 
171 - initWithElement: (OFXMLElement*)element;
172 
180 - initWithXMLString: (OFString*)string;
181 
189 - initWithFile: (OFString*)path;
190 
196 - (void)setName: (OFString*)name;
197 
203 - (OFString*)name;
204 
210 - (void)setNamespace: (OFString*)ns;
211 
217 - (OFString*)namespace;
218 
224 - (OFArray*)attributes;
225 
231 - (void)setChildren: (OFArray*)children;
232 
238 - (OFArray*)children;
239 
246 - (void)setStringValue: (OFString*)stringValue;
247 
256 - (void)addAttribute: (OFXMLAttribute*)attribute;
257 
267 - (void)addAttributeWithName: (OFString*)name
268  stringValue: (OFString*)stringValue;
269 
281 - (void)addAttributeWithName: (OFString*)name
282  namespace: (OFString*)ns
283  stringValue: (OFString*)stringValue;
284 
291 - (OFXMLAttribute*)attributeForName: (OFString*)attributeName;
292 
300 - (OFXMLAttribute*)attributeForName: (OFString*)attributeName
301  namespace: (OFString*)attributeNS;
302 
308 - (void)removeAttributeForName: (OFString*)attributeName;
309 
316 - (void)removeAttributeForName: (OFString*)attributeName
317  namespace: (OFString*)attributeNS;
318 
325 - (void)setPrefix: (OFString*)prefix
326  forNamespace: (OFString*)ns;
327 
334 - (void)bindPrefix: (OFString*)prefix
335  forNamespace: (OFString*)ns;
336 
343 - (void)setDefaultNamespace: (OFString*)ns;
344 
350 - (void)addChild: (OFXMLNode*)child;
351 
357 - (void)removeChild: (OFXMLNode*)child;
358 
364 - (OFArray*)elements;
365 
371 - (OFArray*)elementsForNamespace: (OFString*)elementNS;
372 
379 - (OFXMLElement*)elementForName: (OFString*)elementName;
380 
387 - (OFArray*)elementsForName: (OFString*)elementName;
388 
396 - (OFXMLElement*)elementForName: (OFString*)elementName
397  namespace: (OFString*)elementNS;
398 
406 - (OFArray*)elementsForName: (OFString*)elementName
407  namespace: (OFString*)elementNS;
408 @end
409 
410 #import "OFXMLElement+Serialization.h"