I've seen XML is useful as a data exchange mechanism, as a format tool, and for the seperation of content and structure. but as a data storage, I have two questions: 1. I am thinking database has more advantage over XML, is that true? For example, database has a lot of tools and may be faster in querying. 2. I've never use the import XML function in database. XML employs tree structure, while most commercial database user tables and relationships, how do they import "XML"? Thank you for explaination
It seems a strangely common assumption that XML is some sort of database. However XML is not a form of data storage, it is a form of data markup. Even if you mark up your data in XML, you still have to store it somewhere if you want to keep it around. An XML document-tree can be stored in a text file, for example, or it can be stored in a database, or it can be stored in a LDAP repository, or whatever. Considering databases in particular, there are essentially two ways of storing XML-marked-up data in a database :- as whole documents; or decomposed. To store some XML data as a whole document you might export a DOM tree as a text file and store it in a CLOB or BLOB column. To store a decomposed XML document you might either use domain knowledge to represent the same data in a relational form, or simply "flatten" the document into a key/value map and store that in a table. "Flattening" is something a lot of XML users are not very aware of, but works like this: Take an XML tree, for example: <team> <person sex='male'> <name>Frank Carver</name> <location>England</location> </person> <person sex='female'> <name>Mapraputa Is</name> <location>USA</location> </person> </team> When "flattened" it might look like team.person.@sex=male team.person.name=Frank Carver team.person.location=England team.person.@sex=female team.person.name=Mapraputa Is team.person.location=USA Note that the exact method used to generate the left-hand side "key" varies, but the important thing is that it encodes enough information to regenerate the same XML document.
1. I am thinking database has more advantage over XML, is that true? For example, database has a lot of tools and may be faster in querying. Abolutely. Here is my canned list of database virtues: transactional integrity security authentication concurrency control data validation and conversion search mechanism XML was created as a substitution for HTML to allow "meaningful" markup, so search engines could do better job etc. Looking at what it becomes... Here is a quote from XMLHack: "Edd Dumbill opens the XML Europe 2002 conference by questioning whether XML has become the "SGML on the Web" which it was meant to be. "XML has achieved more than we could believe and is even ridiculously widespread to the point that we find it in the configuration files of our PC. It's been used to integrate to web web cell phones and set top boxes and is even been taught in the universities. " http://xmlhack.com/read.php?item=1654 2. I've never use the import XML function in database. XML employs tree structure, while most commercial database user tables and relationships, how do they import "XML"? To add to what is already said, chances are that imported XML is nothing but another database's unload - i.e. the very tables represented as a tree. I would love to see statistics on what percent of XML documents have table-like nature. -------------------- "There are no answers, only cross references."
Stinging nettles are edible. But I really want to see you try to eat this tiny ad: