Objective-C中复杂的XMLparsing

我必须阅读和显示我的书籍应用程序内的多个字符对话框。 我打算以下列格式将字符对话数据存储在XML中:

<?xml version="1.0" encoding="UTF-8"?> <Pages> <Page Id="P1"> <T>Once upon a time in the deep jungle of sunderbun there lived a lazy and wicked Jackal.Once upon a time in the deep jungle of sunderbun there lived a lazy and wicked Jackal.</T> <A>This is audio file location.This is audio file location.This is audio file location.</A> <Dlg> <Dlg Id="C1D1" P="L" X="" Y="" W="" H=""> <T>This is Character 1 Dialogue 1.This is Character 1 Dialogue 1.</T> <A>This is audio file location.This is audio file location.</A> </Dlg> <Dlg Id="C1D2" P="R" X="" Y="" W="" H=""> <T>This is Character 1 Dialogue 2.This is Character 1 Dialogue 2.</T> <A>This is audio file location.This is audio file location.</A> </Dlg> <Dlg Id="C2D1" P="L" X="" Y="" W="" H=""> <T>This is Character 2 Dialogue 1.This is Character 2 Dialogue 1.</T> <A>This is audio file location.This is audio file location.</A> </Dlg> </Dlg> </Page> <Page Id="P2"> <T>Once upon a time in the deep jungle of sunderbun there lived a lazy and wicked Jackal.Once upon a time in the deep jungle of sunderbun there lived a lazy and wicked Jackal.</T> <A>This is audio file location.This is audio file location.This is audio file location.</A> <Dlg> <Dlg Id="C1D1" P="R" X="" Y="" W="" H=""> <T>This is Character 1 Dialogue 1.This is Character 1 Dialogue 1.</T> <A>This is audio file location.This is audio file location.</A> </Dlg> <Dlg Id="C2D1" P="L" X="" Y="" W="" H=""> <T>This is Character 2 Dialogue 1.This is Character 2 Dialogue 1.</T> <A>This is audio file location.This is audio file location.</A> </Dlg> <Dlg Id="C2D2" P="R" X="" Y="" W="" H=""> <T>This is Character 2 Dialogue 2.This is Character 2 Dialogue 2.</T> <A>This is audio file location.This is audio file location.</A> </Dlg> </Dlg> </Page> </Pages> 

从XML结构可以看出,会有多个页面,每个页面都有多个字符,每个字符都有多个对话框。 这个XML的大小可能在250 KB左右(不知道这对于iPhone / iPad来说太大了)。 我打算使用GDataXMLparsing这个XML,并存储为以下模型对象:

 #import <Foundation/Foundation.h> typedef enum { Left, Right } DialoguePosition; @interface Dialogue : NSObject{ NSString *_id; int _frameX; int _frameY; int _frameWidth; int _frameHeight; DialoguePosition _dialoguePosition; NSString *_dialogueText; NSString *_dialogueAudioLocation; } @property (nonatomic, copy) NSString *id; @property (nonatomic, assign) int frameX; @property (nonatomic, assign) int frameY; @property (nonatomic, assign) int frameWidth; @property (nonatomic, assign) int frameHeight; @property (nonatomic, assign) DialoguePosition dialoguePosition; @property (nonatomic, copy) NSString *dialogueText; @property (nonatomic, copy) NSString *dialogueAudioLocation; - (id)initWithName:(NSString *)id frameX:(int)frameX frameY:(int)frameY frameWidth:(int)frameWidth frameHeight:(int)frameHeight dialoguePosition:(DialoguePosition)dialoguePosition dialogueText:(NSString *)dialogueText dialogueAudioLocation:(NSString *)dialogueAudioLocation; @end 

我应该使用属性列表而不是XML或XML应该罚款吗? 我需要通过传递页面ID和对话ID方便快捷地访问对话。 为了实现这一点,我应该在NSDictionary中存储对话模型对象还是应该去其他更好的方法。 我希望你对我应该采取的方法提出build议。