Search code examples
xmlcalendarorganizer

XML structure for a personal organizer


I'm doing a personal organizer for learning purposes, and i've never worked with XML so i'm not sure if my solution is the best. Here's the basic structure for the XML file i came with:

<calendar>
    <year value="2008">
        <month value="october">
            <day value="16">
                <activity name="mike's birthday" time="21:00" address="mike's apartment" urgency="10">
                     activity description.
                </activity>
            </day>
        </month>
    </year>
</calendar>

The urgency attribute should be on a scale of 1 to 10.
I did a quick search on google and couldn't find a good example. Maybe that's not the best solution, and i'd like to know if its adequate. I'm doing the application in PHP if that has any relevance.


Solution

  • Your way is quite adequate to me. However, I prefer child tags to attributes, so my way would be more like:

    <activity>
      <name>Mike's Birthday</name>
      <time>2100</time>
      <address>Mike's Place</address>
      <urgency>10</urgency>
      <description>activity description</description>
    </activity>
    

    But like I said, your way is just fine.

    Quick question, though - why not a database?