ObjFW
src/OFXMLElement.h
00001 /*
00002  * Copyright (c) 2008, 2009, 2010, 2011
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 "OFObject.h"
00018 #import "OFXMLAttribute.h"
00019 
00020 @class OFString;
00021 @class OFArray;
00022 @class OFMutableString;
00023 @class OFMutableArray;
00024 @class OFMutableDictionary;
00025 
00029 @interface OFXMLElement: OFObject
00030 {
00031         OFString *name;
00032         OFString *ns;
00033         OFString *defaultNamespace;
00034         OFMutableArray *attributes;
00035         OFMutableDictionary *namespaces;
00036         OFMutableArray *children;
00037         OFString *characters;
00038         OFString *cdata;
00039         OFMutableString *comment;
00040 }
00041 
00042 #ifdef OF_HAVE_PROPERTIES
00043 @property (readonly, copy) OFString *name;
00044 @property (readonly, copy, getter=namespace) OFString *ns;
00045 @property (copy) OFString *defaultNamespace;
00046 @property (readonly, copy) OFArray *attributes;
00047 @property (readonly, copy) OFArray *children;
00048 #endif
00049 
00054 + elementWithName: (OFString*)name;
00055 
00062 + elementWithName: (OFString*)name
00063       stringValue: (OFString*)stringval;
00064 
00071 + elementWithName: (OFString*)name
00072         namespace: (OFString*)ns;
00073 
00081 + elementWithName: (OFString*)name
00082         namespace: (OFString*)ns
00083       stringValue: (OFString*)stringval;
00084 
00092 + elementWithCharacters: (OFString*)chars;
00093 
00100 + elementWithCDATA: (OFString*)cdata;
00101 
00108 + elementWithComment: (OFString*)comment;
00109 
00116 + elementWithXMLString: (OFString*)str;
00117 
00125 - initWithName: (OFString*)name;
00126 
00136 - initWithName: (OFString*)name
00137    stringValue: (OFString*)stringval;
00138 
00148 - initWithName: (OFString*)name
00149      namespace: (OFString*)ns;
00150 
00161 - initWithName: (OFString*)name
00162      namespace: (OFString*)ns
00163    stringValue: (OFString*)stringval;
00164 
00172 - initWithCharacters: (OFString*)chars;
00173 
00181 - initWithCDATA: (OFString*)cdata;
00182 
00190 - initWithComment: (OFString*)comment;
00191 
00198 - initWithXMLString: (OFString*)str;
00199 
00203 - (OFString*)name;
00204 
00208 - (OFString*)namespace;
00209 
00213 - (OFArray*)attributes;
00214 
00220 - (void)setChildren: (OFArray*)children;
00221 
00225 - (OFArray*)children;
00226 
00232 - (void)setStringValue: (OFString*)value;
00233 
00237 - (OFString*)stringValue;
00238 
00243 - (OFString*)XMLString;
00244 
00253 - (void)addAttribute: (OFXMLAttribute*)attr;
00254 
00264 - (void)addAttributeWithName: (OFString*)name
00265                  stringValue: (OFString*)value;
00266 
00277 - (void)addAttributeWithName: (OFString*)name
00278                    namespace: (OFString*)ns
00279                  stringValue: (OFString*)value;
00280 
00285 - (OFXMLAttribute*)attributeForName: (OFString*)attrname;
00286 
00292 - (OFXMLAttribute*)attributeForName: (OFString*)attrname
00293                           namespace: (OFString*)attrns;
00294 
00300 - (void)removeAttributeForName: (OFString*)attrname;
00301 
00308 - (void)removeAttributeForName: (OFString*)attrname
00309                      namespace: (OFString*)attrns;
00310 
00317 - (void)setPrefix: (OFString*)prefix
00318      forNamespace: (OFString*)ns;
00319 
00326 - (void)bindPrefix: (OFString*)prefix
00327       forNamespace: (OFString*)ns;
00328 
00334 - (void)setDefaultNamespace: (OFString*)ns;
00335 
00341 - (void)addChild: (OFXMLElement*)child;
00342 
00347 - (OFXMLElement*)elementForName: (OFString*)elemname;
00348 
00353 - (OFArray*)elementsForName: (OFString*)elemname;
00354 
00360 - (OFXMLElement*)elementForName: (OFString*)elemname
00361                       namespace: (OFString*)elemns;
00362 
00368 - (OFArray*)elementsForName: (OFString*)elemname
00369                   namespace: (OFString*)elemns;
00370 @end
 All Classes Functions Variables