[Home] [By Thread] [By Date] [Recent Entries]



In other words, XML in a relational database is a hack?


Ronald Bourret wrote:
> It's a bit hard to get used to the idea, but an "XML type" is a first 
> class data type whose disk storage is optimized for XML.
> 
> By analogy, think about how other data types are stored. A two byte 
> integer data type is stored in two bytes where each bit is treated as a 
> digit in a binary number. A ten-byte ASCII character data type is stored 
> as ten bytes where each byte is treated as an integer representing an 
> ASCII character. And an XML data type is stored (insert leap of faith 
> here) in a structure designed to hold an XML document.
> 
> What's weird about this is that we're used to thinking of relational 
> data types as scalar types, whereas the XML data type has much more 
> structure. However, this isn't much different than in object-relational 
> databases where a column can have an object data type, although that is 
> presumably mapped to a set of scalar storage locations under the covers.
> 
> How the XML data type is actually stored depends on the database. For 
> example, Oracle stores complete XML documents in CLOBs and indexes the 
> heck out of them. SQL Server stores documents using a proprietary binary 
> format in BLOBs, as well as storing them in a node table with columns 
> like node ID, node name, node type, parent ID, and node value. DB2 
> stores documents using a proprietary disk format that is designed for 
> node-level addressability and is separate from their relational storage.
> 
> Another way to think about all of this is that the XML data type is the 
> exposed tip of a native XML database embedded inside a relational database.
> 
> Clear as mud?
> 
> -- Ron

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member