I have a classes looking like this:
@interface AISlideItem: NSObject <NSCoding>
{
NSString* PlaceHolderName;
NSInteger PlaceHolderID;
}
@property (nonatomic, strong) NSString* PlaceHolderName;
@property (nonatomic) NSInteger PlaceHolderID;
@end
@interface AITitleSlideItem : AISlideItem
{
NSString* Title;
}
@property (nonatomic, strong) NSString* Title;
@end
@interface AIParagraphSlideItem : AISlideItem
{
NSMutableArray* Paragraphs;
}
@property (nonatomic, strong) NSMutableArray* Paragraphs;
@end
@interface AITextSlideItem : AISlideItem
{
NSString* Text;
}
@property (nonatomic, strong) NSString* Text;
@end
@interface AIPictureSlideItem : AISlideItem
{
NSMutableData* Picture;
}
@property (nonatomic, strong) NSMutableData* Picture;
@end
@interface AISlideContent : NSObject
{
NSString* LayoutName;
NSMutableArray* Items;
}
@property (nonatomic,strong) NSString* LayoutName;
@property (nonatomic,strong) NSMutableArray* Items;
@end
@interface ContentParaghraph : NSObject
{
NSInteger Level;
NSString* Text;
}
@property (nonatomic) NSInteger Level;
@property (nonatomic, strong) NSString* Text;
@end
I create a complex collection from these classes like this:
NSMutableArray* l = [[NSMutableArray alloc]init ];
AITitleSlideItem* tis1 = [[AITitleSlideItem alloc]init];
[tis1 setPlaceHolderName:@"I don't think we're using this..."];
[tis1 setPlaceHolderID:1];
[tis1 setTitle:@"This is a title"];
AITextSlideItem* tes1 = [[AITextSlideItem alloc]init];
[tes1 setPlaceHolderName:@"I don't think we're using this..."];
[tes1 setPlaceHolderID:2];
[tes1 setText:@"This is the description"];
AISlideContent* slide1 = [[AISlideContent alloc]init];
[slide1 setLayoutName:@"Title content"];
[[slide1 Items]addObject:tis1];
[[slide1 Items]addObject:tes1];
[l addObject:slide1];
[l addObject:slide1];
What i want to to serialize the NSMutableArray l into any portable format like json or xml. Could you please post some code doing so?
Sincerely
Zoli