Home > Articles > Programming > Windows Programming

  • Print
  • + Share This
This chapter is from the book

Creating XSD Schemas

Whenever you utilize or manipulate data, you need to have a way of answering certain questions about that data. Do you define an Invoice ID as a textual or numeric value? Is a phone number limited to ten digits? More?

There are several ways to do this. First, you can simply provide validation logic in code, just as any software application would. This defeats the purpose of XML on a number of levels, though. Remember that XML is designed to be interoperable and human-readable. When you commit validation logic to code, you've almost inherently made the validation logic inaccessible to other processes that might come along later.

Document Type Definitions (DTDs)

The first technology used for defining XML structures was known as the Document Type Definition (DTD). The problem with DTDs is that they have their own weird syntax that has nothing to do with XML. A good example of a DTD is the DTD for XML itself, which resides at http://www.w3.org/XML/1998/06/xmlspec-v21.dtd.

Microsoft chose to use a more evolved document definition technology for XML in the .NET universe—the XML schema. Visual Studio.NET gives developers a graphical way to build XML schemas and contains little or no support for DTDs. For this reason, this book will focus on schemas rather than DTDs.

  • + Share This
  • 🔖 Save To Your Account