in reply to XML and file size
Keep in mind that appending to a text file, and "appending" to an XML file, are not exactly the same, because the XML file will (should?) have some internal structure. For example, suppose you choose one file per month. Then a journal file might look something like this:
<entries month="2003-01"> <entry date="2003-01-01"> <p>Hung over.</p> </entry> <entry date="2003-01-02"> <p>Still hung over.</p> </entry> <entry date="2003-01-03"> <p>Better today. Phew.</p> <p>Wish I didn't have to go to work, though.</p> </entry> </entries>
When you create your next entry element, you'll be sticking it inside the entries element, rather than at the end of the file. So instead of opening the file for appending, you can either:
There's nothing inherently wrong with choice 2, but it'll get slower and more expensive as you add more entries. Choice 1 will get increasing more difficult and crufty as soon as you try to do something other than append entries.
As chromatic (I believe it was) mentioned, you also need to think about what you want to do with these entries. Search them? Display arbitrary sets based on date/subject/keywords/etc? If you ever want groupings other than the one you're thinking about for storage, then you may prefer to store each entry separately.
HTH!
--roundboy
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: XML and file size
by gjb (Vicar) on Jan 07, 2003 at 02:23 UTC | |
by roundboy (Sexton) on Jan 07, 2003 at 18:38 UTC |