My Favorite Way
Category: XML Questions | 2 views | Add a Comment
like to store data in child elements.
The following three XML documents contain exactly the same information:A date attribute is used in the first example:
< note date=”12/11/99″ >
< to > Tove < /to > < from > Jani < / from >
< heading > Reminder < /heading >
< body > Don’t forget me this weekend! < /body >
< / note >
A date element is used in the second example:
< note >
< date > 12/11/99 < /date > < to > Tove< /to >
< from > Jani < /from > < heading > Reminder < /heading >
< body > Don’t forget me this weekend! < /body >
< /note >
An expanded date element is used in the third: (THIS IS MY FAVORITE):
< note >
< date >
< day > 12 < /day >
< month > 11 < /month >
< year > 99 < /year >
< /date >
< to > Tove < /to >
< from > Jani < /from >
< heading > Reminder < /heading >
< body > Don’t forget me this weekend! < /body >
< /note >
