root/Trunk/Adium.framework/Versions/A/Headers/AIXMLElement.h @ 2

Revision 2, 3.3 KB (checked in by jon, 16 years ago)

Initial commit of skeletal project.

Line 
1/* AIXMLElement.h
2 *
3 * Created by Peter Hosey on 2006-06-07.
4 *
5 * This class is explicitly released under the BSD license with the following modification:
6 * It may be used without reproduction of its copyright notice within The Adium Project.
7 *
8 * This class was created for use in the Adium project, which is released under the GPL.
9 * The release of this specific class (AIXMLElement) under BSD in no way changes the licensing of any other portion
10 * of the Adium project.
11 *
12 ****
13 Copyright © 2006 Peter Hosey, Colin Barrett
14 All rights reserved.
15 
16 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
17 Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
18 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
19 Neither the name of Peter Hosey nor the names of his contributors may be used to endorse or promote products derived from this software without specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 */
23
24//FIXME: This class is not CodingStyle compliant.
25@interface AIXMLElement : NSObject <NSCopying> {
26        NSString *name;
27        NSMutableArray *attributeNames;
28        NSMutableArray *attributeValues;
29        NSMutableArray *contents;
30        BOOL selfCloses;
31}
32
33+ (id) elementWithNamespaceName:(NSString *)namespace elementName:(NSString *)newName;
34- (id) initWithNamespaceName:(NSString *)namespace elementName:(NSString *)newName;
35+ (id) elementWithName:(NSString *)newName;
36- (id) initWithName:(NSString *)newName;
37
38#pragma mark Accessors
39
40- (NSString *) name;
41
42- (unsigned)numberOfAttributes;
43- (NSDictionary *)attributes;
44- (void) setAttributeNames:(NSArray *)newAttrNames values:(NSArray *)newAttrVals;
45
46- (void)setValue:(NSString *)attrVal forAttribute:(NSString *)attrName;
47- (NSString *)valueForAttribute:(NSString *)attrName;
48
49- (BOOL) selfCloses;
50- (void) setSelfCloses:(BOOL)flag;
51
52#pragma mark Contents
53
54//NSString: Unescaped string data (will be escaped when making XML data).
55//AIXMLElement: Sub-element (e.g. span in a p).
56- (void) addObject:(id)obj;
57- (void) addObjectsFromArray:(NSArray *)array;
58- (void) insertObject:(id)obj atIndex:(unsigned)idx;
59
60- (NSArray *)contents;
61- (void)setContents:(NSArray *)newContents;
62- (NSString *)contentsAsXMLString;
63
64#pragma mark XML representation
65
66- (NSString *) XMLString;
67- (void) appendXMLStringtoString:(NSMutableString *)string;
68
69- (NSData *) UTF8XMLData;
70- (void) appendUTF8XMLBytesToData:(NSMutableData *)data;
71
72@end
Note: See TracBrowser for help on using the browser.