ObjFW
src/OFXMLElement.h
00001 /*
00002  * Copyright (c) 2008, 2009, 2010, 2011, 2012
00003  *   Jonathan Schleifer <js@webkeks.org>
00004  *
00005  * All rights reserved.
00006  *
00007  * This file is part of ObjFW. It may be distributed under the terms of the
00008  * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
00009  * the packaging of this file.
00010  *
00011  * Alternatively, it may be distributed under the terms of the GNU General
00012  * Public License, either version 2 or 3, which can be found in the file
00013  * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
00014  * file.
00015  */
00016 
00017 #import "OFXMLNode.h"
00018 
00019 @class OFString;
00020 @class OFArray;
00021 @class OFMutableString;
00022 @class OFMutableArray;
00023 @class OFMutableDictionary;
00024 @class OFXMLAttribute;
00025 
00029 @interface OFXMLElement: OFXMLNode
00030 {
00031         OFString *name;
00032         OFString *ns;
00033         OFString *defaultNamespace;
00034         OFMutableArray *attributes;
00035         OFMutableDictionary *namespaces;
00036         OFMutableArray *children;
00037 }
00038 
00039 #ifdef OF_HAVE_PROPERTIES
00040 @property (copy) OFString *name;
00041 @property (copy, getter=namespace, setter=setNamespace:) OFString *ns;
00042 @property (copy) OFString *defaultNamespace;
00043 @property (readonly, copy) OFArray *attributes;
00044 @property (readonly, copy) OFArray *children;
00045 #endif
00046 
00053 + elementWithName: (OFString*)name;
00054 
00063 + elementWithName: (OFString*)name
00064       stringValue: (OFString*)stringValue;
00065 
00074 + elementWithName: (OFString*)name
00075         namespace: (OFString*)ns;
00076 
00087 + elementWithName: (OFString*)name
00088         namespace: (OFString*)ns
00089       stringValue: (OFString*)stringValue;
00090 
00098 + elementWithElement: (OFXMLElement*)element;
00099 
00106 + elementWithXMLString: (OFString*)string;
00107 
00115 + elementWithFile: (OFString*)path;
00116 
00123 - initWithName: (OFString*)name;
00124 
00134 - initWithName: (OFString*)name
00135    stringValue: (OFString*)stringValue;
00136 
00146 - initWithName: (OFString*)name
00147      namespace: (OFString*)ns;
00148 
00159 - initWithName: (OFString*)name
00160      namespace: (OFString*)ns
00161    stringValue: (OFString*)stringValue;
00162 
00171 - initWithElement: (OFXMLElement*)element;
00172 
00180 - initWithXMLString: (OFString*)string;
00181 
00189 - initWithFile: (OFString*)path;
00190 
00196 - (void)setName: (OFString*)name;
00197 
00203 - (OFString*)name;
00204 
00210 - (void)setNamespace: (OFString*)ns;
00211 
00217 - (OFString*)namespace;
00218 
00224 - (OFArray*)attributes;
00225 
00231 - (void)setChildren: (OFArray*)children;
00232 
00238 - (OFArray*)children;
00239 
00246 - (void)setStringValue: (OFString*)stringValue;
00247 
00256 - (void)addAttribute: (OFXMLAttribute*)attribute;
00257 
00267 - (void)addAttributeWithName: (OFString*)name
00268                  stringValue: (OFString*)stringValue;
00269 
00281 - (void)addAttributeWithName: (OFString*)name
00282                    namespace: (OFString*)ns
00283                  stringValue: (OFString*)stringValue;
00284 
00291 - (OFXMLAttribute*)attributeForName: (OFString*)attributeName;
00292 
00300 - (OFXMLAttribute*)attributeForName: (OFString*)attributeName
00301                           namespace: (OFString*)attributeNS;
00302 
00308 - (void)removeAttributeForName: (OFString*)attributeName;
00309 
00316 - (void)removeAttributeForName: (OFString*)attributeName
00317                      namespace: (OFString*)attributeNS;
00318 
00325 - (void)setPrefix: (OFString*)prefix
00326      forNamespace: (OFString*)ns;
00327 
00334 - (void)bindPrefix: (OFString*)prefix
00335       forNamespace: (OFString*)ns;
00336 
00343 - (void)setDefaultNamespace: (OFString*)ns;
00344 
00350 - (void)addChild: (OFXMLNode*)child;
00351 
00357 - (void)removeChild: (OFXMLNode*)child;
00358 
00364 - (OFArray*)elements;
00365 
00371 - (OFArray*)elementsForNamespace: (OFString*)elementNS;
00372 
00379 - (OFXMLElement*)elementForName: (OFString*)elementName;
00380 
00387 - (OFArray*)elementsForName: (OFString*)elementName;
00388 
00396 - (OFXMLElement*)elementForName: (OFString*)elementName
00397                       namespace: (OFString*)elementNS;
00398 
00406 - (OFArray*)elementsForName: (OFString*)elementName
00407                   namespace: (OFString*)elementNS;
00408 @end
00409 
00410 #import "OFXMLElement+Serialization.h"
 All Classes Functions Variables Properties