XML Schemas

I mentioned earlier that DTDs were somewhat old-fashioned. The reason for this is that there's a newer, better technology for validating XML documents. It's called XML Schema. Unlike DTDs, you build XML Schema documents using XML. They consist of elements and attributes just like the XML documents they validate. They have a number of other advantages over DTDs, including the following.

  • DTDs cannot control what kind of information a given element or attribute can contain. Merely being able to specify that an element stores text is not precise enough for most business needs. We might want to specify what format the text should have or whether the text is a date or a number. XML Schema has extensive support for data domain control.

Get Guru's Guide to SQL Server Architecture and Internals, The now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.