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 00019 @class OFString; 00020 @class OFArray; 00021 @class OFMutableString; 00022 @class OFMutableArray; 00023 @class OFMutableDictionary; 00024 @class OFXMLAttribute; 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) OFString *namespace; 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 00117 - initWithName: (OFString*)name; 00118 00128 - initWithName: (OFString*)name 00129 stringValue: (OFString*)stringval; 00130 00140 - initWithName: (OFString*)name 00141 namespace: (OFString*)ns; 00142 00153 - initWithName: (OFString*)name 00154 namespace: (OFString*)ns 00155 stringValue: (OFString*)stringval; 00156 00164 - initWithCharacters: (OFString*)chars; 00165 00173 - initWithCDATA: (OFString*)cdata; 00174 00182 - initWithComment: (OFString*)comment; 00183 00187 - (OFString*)name; 00188 00192 - (OFString*)namespace; 00193 00197 - (OFArray*)attributes; 00198 00202 - (OFArray*)children; 00203 00208 - (OFString*)stringValue; 00209 00215 - (void)addAttribute: (OFXMLAttribute*)attr; 00216 00223 - (void)addAttributeWithName: (OFString*)name 00224 stringValue: (OFString*)value; 00225 00233 - (void)addAttributeWithName: (OFString*)name 00234 namespace: (OFString*)ns 00235 stringValue: (OFString*)value; 00236 00243 - (void)setPrefix: (OFString*)prefix 00244 forNamespace: (OFString*)ns; 00245 00252 - (void)bindPrefix: (OFString*)prefix 00253 forNamespace: (OFString*)ns; 00254 00260 - (void)setDefaultNamespace: (OFString*)ns; 00261 00267 - (void)bindDefaultNamespace: (OFString*)ns; 00268 00274 - (void)addChild: (OFXMLElement*)child; 00275 @end