A Friendly Approach to XML - Keeping Your Data and Context Separated
(Page 4 of 4 )
Another nice feature of XML is that you can keep your data without any format. Then later on, you can apply style sheets to display the data any way you like, without having to create a whole new list of data. You can take your one file of XML data and display it across multiple web sites, offline spreadsheets, on mobile phones, through RSS feeds, and so forth, without ever touching the original data. This can save you a ton of time, and helps keep the integrity of your data, since you won't constantly be fiddling with it.
Imposing Rules on Your Data
We'll discuss Document Type Definitions (DTDs) and XML Schemas in a later article. For this section though, I would like for you to know that they provide a way for you to set certain rules for your data. A good example of this is if someone is entering in prices for a database of songs, you want to ensure that no letters end up in the price field, which should only be used for numbers. XML can help you do this, ensuring the integrity of your information.
You can also use rules to define the format of the information. For instance, your price field should have a currency format, and a date of release should have a date format. This is all achievable via DTDs and Schemas.
A Final Word
XML is also good when you need functionality across any platform. We touched upon this briefly above. Whether it is in Windows, Linux, or a Mac operating system, XML does not care. And the same goes for outputting your data. As stated previously, there are many formats in which you'll be able to show your information, whether it be spreadsheet, word document, RSS feed, in Flash, on a static website; the list goes on and on.
In our next article we will begin to discuss how to actually use XML, beginning with syntax and structure.
Thank you and I hope you enjoyed my article.
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.