Jump to content

When to use XML vs SQL


watagal

Recommended Posts

GreetingsI'm new at all of this, so I have a general question on 'when to use' what. I'm writing a front end to a manual. The data is stored in a MySQL db. I can write a query to get the topic data from MySQL, write an XML schema, and (in the future, I hope to) write the HTML code to display it (more questions on that later). The data is pretty static, so should I regenerate the XML everytime it is called or store XMLs as they are created for future recall - or is this more complicated.I would really like to hear how others are using this.TIA,WG

Link to comment
Share on other sites

Most of the time it depends on things such as... how is this data used? What's it for?I like to think that MySQL should be used for catalouge purposes, while XML should be used for everything else. For example, you would store personal user's settings in MySQL scince they have to be private and XML files are insecure after all.You should also store different products' data in MySQL, scince the user should only see a certain amount of products and their data at times and MySQL is kind'a more dynamic then XML.Every "per page" and "global" data however could/should be stored in XML, scince it's part of the overall site's "feel". In the case of a manual, I would say you could/should store each topic in it as an XML file scince the data is "static" instead of having the same type of data varying in each page.XML should also be used if this data must be avaiable on more then one device, simply becuause of easier maintainance. For example interface data (which is also a "global" data, so the previous criteria also applyes). Certain things such as "Home", "About Us" and other things you might add but yet look different on different devices. Those things could easily be manipulated within a single XML file and yet been handled smoothly.In short, XML should be used everywhere where plain XHTML faills in terms of easier maintainance. Everywhere you would use MySQL database anyway, use it.

Link to comment
Share on other sites

XML files are only plain text with tags, so yeah, they are searchable. The problem however is that there isn't yet a language that provides a mechanism equal to SQL with which you could check up and/or manipulate speficic data. There is XQuery coming though, so at one point they will be equally searchable. Until then, in order to create a search engine for XML file(s), you would have to be a bit more creative then with MySQL.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...