Results 1 to 2 of 2
Thread: Why use database AND XML
May 31, 2002, 08:24 #1
- Join Date
- May 2002
- Ljubljana, Slovenia
- 0 Post(s)
- 0 Thread(s)
Why use database AND XML
Can someone please explain to me what is the benefit of using database (like MySQL) with XML documents. It is not clear to me why would it be cool to store XML tagged content into database.
Inspiration for this question was Kevin Yanks article Get XSL To Do Your Dirty Work. If you look at Figure 8 you can see how it should be done. But this seems illogical. You either use XML or database. Or am I wrong here?
Please list benefits of doing that and drawbacks too. Thanks
P.S.: It's a great article though, Kevin.
May 31, 2002, 09:05 #2
- Join Date
- Aug 1999
- Lancaster, Ca. USA
- 1 Post(s)
- 0 Thread(s)
Personally, I wouldn't store XML encoded documents in the database unless the encoding was for display purposes (i.e. bold, italic, color, headings, etc..) for say an Article.
However let me explain why you would use both here because they both serve completely different purposes and people tend to get them confused.
First of look at this:
Processed Date XML
| | | |
HTML WML RSS Data Interchange
Using the database to store your raw unformatted data gives you the best use of resources and power. SQL is very fast at getting the data you need to you when you need it. By storing this data in a raw format you can do many things with it. You can run statistical analyses on it, massage the data for data mining, print reports and even put it in XML encoded tags for further processing.
XML is good to share data among systems. It allows you to define what each tag is. Your data then becomes a portable recordset of your raw data. This can be the entire table or simply those records that match a particular criteria such as "zipcode = 12345" from here the computer can format the data for "display" according to the end user's device (Computer, PDA, Speakerphone, etc...), pass the data to another system in a recognized form such as RSS or exchange data with the other system.
Exchanging Data with other systems is where the strength of XML comes in. Using a definable DTD, you can tell other computers exactly what you are giving them and they can process that data and give you an answer. United Parcel Service does this with their online shipping calculators now. You send them shipping data in XML format containing number of boxes, shipping address, ship to address, weight and classification and they can send you back a price almost instantly. All this is done through XML via a data interchange DTD they developed. Other companies can do the same thing.