For instance, I have a movie/item. It opens on Jan 1 2010 and finishes on Jan 10 2010. Do I create an entry for each date that the movie/item occurs, repeating all the data for each date? or do I create two nodes within the movie/item specifying a start date and end date and create an argument to provide all the data as needed? I want to be able to filter entries based on the movie/item Category eliminating repeats and also be able to sort the list by Date.
views:
40answers:
1
A:
I hop I got you right. You'll see.
Why not separate like this:
<db>
<movies>
<movie id="in_ba">
<name>Inglorious Basterds</name>
<!-- more info here -->
</movie>
</movies>
<times>
<item movieid="in_ba">
<open>00.00.00 00:00:00.00 UTC+0</open>
<close>00.00.00 00:00:00.00 UTC+0</close>
</item>
</times>
</db>
cimnine
2009-09-22 15:30:40
Yeah, spot on if close means some point in the future. This was what I was thinking of for the second model. Are there any performance issues with this approach? How do I create a statement to pick up an entry of the entire record each time it meets a point between open and close?
Jim
2009-09-22 16:16:48
You'd have issues once the file gets a lot of items. Then I would think of separating the movies in another file.Other drawbacks are that you have to query for each 'item' the 'movie'. So a second query is needed.Querying the items: Iterate through every 'item', check the open date. In the same step check if the close date is in your range.Instead of XML you could us 'sqlite', which should be provided with the iPhone. A short Google-Query results in this tut: http://tinyurl.com/3u5bnh
cimnine
2009-09-22 16:46:23
Brilliant, thanks for your reply. I was going to parse it with SAX and store it in sqlite anyway. I hadn't thought about an additional field as a means to provide secondary look-up.
Jim
2009-09-22 17:20:48