views:

336

answers:

4

Ok, so I've finally decided on how to load my data I'm going to go with loading my book data as an XML file. The problem is that I'm not too sure on where to start, I've heard terms such 'parsing' but dont know how exactly it fits in.

I have added the code below if someone could give me a start in the right direction I would really appreciate that, to begin with all I want to do is load one line with my own comment under that and then the next line and so on.

<myBook>
−  <chapter index="1" name="Chapter Name">
<line index="1" text="line text here"/>
<line index="2" text=" line text here "/>
<line index="3" text=" line text here "/>
<line index="4" text=" line text here "/>
<line index="5" text=" line text here "/>
<line index="6" text=" line text here "/>
<line index="7" text=" line text here "/>
</chapter>

Thanks guys,

A: 

Use Cocoa's XML parser?

Joshua Nozzi
+1  A: 

Maybe this questions helps you: http://stackoverflow.com/questions/762567/navigating-xml-from-objective-c

There a some classes with which you can process your XML file. If you don't know about XML in general, read the Wikipedia article about XML. The most common techniques that are used to process XML are also described there.

Felix Kling
A: 

Apple's NSXMLParser is an event based based on libXML, it is a SAX parser. I have found it to be slow when parsing large files on the iPhone 3G as it doesn't take advantage of libXML's xmlParseChunk() function.

Have you thought about using JSON as an alternative?

Easen
A: 

Do you really mean "load into Xcode" or are you talking about reading your custom XML file in your application? And didn't you ask this as http://stackoverflow.com/questions/2367456/how-to-load-xml-file-into-iphone-project ?

cdespinosa
Hi, sorry about that I didnt realise they were so similar, the problem is that I'm trying to word the problem correctly but keep getting confused myself, as I only need to load data for this one part of my app ( although it is the main part of the app :) ) It is a custom XML file I'm trying to load, its the exact same structure as the code I pasted above.Thanks and sorry about that again,
Dave