This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
What difference does it make having date declared as a child element or as an attribute of note element.
To some extent this is a author style thing with no hard and fast rule. I have seen plenty of XML extremes with no attributes or all attributes. As you gain more experience with the various XML toolkits I'm sure you will develop your own style.
Mainly you should be aware of the limitations on the character content in attributes before you try to use nothing but attributes.
Please find the below limitations of using the attributes rather elements
attributes cannot contain multiple values (child elements can) attributes are not easily expandable (for future changes) attributes cannot describe structures (child elements can) attributes are more difficult to manipulate by program code attribute values are not easy to test against a Document Type Definition (DTD) - which is used to define the legal elements of an XML document
Adding as a node is more preferable as it is easily readable. You can consider putting as an attribute if that attribute is short & constant. What if in the future there is a change expected in date to specify date format information ..? In this case you cannot go on adding attributes. It is rather better to have date as node so that it can be open for having child attributes.