|
June 2001
XMLEGANT ANSWERS
The Schema Is the Thing
by Bill Trippe
If your organization has been working with XML, you likely already have document type definitions (DTDs) and XML schemas in the mix. Both DTDs and schemas provide a formal means for describing the structure of your XML data, but schemas are the new kids on the block and will slowly, but surely, edge out their more mature DTD brethren. And for good reason. Whereas DTDs are a remnant of XML's predecessor, SGML, XML schemas are powerful tools being used by programmers in ways that are important to the new enterprise infrastructure.
DTDs and schemas do two things in describing XML data structures: They provide a means for declaring "syntax" and a means for "data typing." Syntax refers to the elements that can appear in the XML, and the order in which they can appear. Data typing, as database specialists will tell you, refers to the constraints that can be placed on a given element: A phone number element, for example, should be 10 digits; a state element can be constrained to one of 50 valid two-letter abbreviations.
It is in this area of data typing that schemas begin to show their advantages. Programmers who are new to XML and DTDs are surprised to find there is no way, for example, to declare that an attribute can contain only digits, let alone whether the digits must be in a certain range. The XML schema proposal that has recently reached the "proposed recommendation" stage at the World Wide Web Consortium adds exactly these kinds of features, and it gives programmers many of the data-typing features they often employ when working with relational databases.
Schemas, then, give developers stronger tools for determining the validity of an XML document or data set. A set of customer records that follow a given schema can more easily be passed from server to server and be validated at both ends. More significantly, armed with a schema, the enterprising developer can create tools for common needs such as editing data securely, loading data into various databases, or mapping XML data to another, related schema.
Some alarmists fret about the proliferation of schemas and the need for tools to map data from one schema to another, but this is misspent anxiety. As the use of XML matures, it is increasingly clear that XML is less about how data is stored than it is about how data flows from one system to another. Schemas, and methods for mapping between schemas, will become tools of the trade. Developers
already have a range of tools available, from commercial products such as Composer, from Whitehill, Moncton, New Brunswick, Canada, to freely available XSLT (extensible stylesheet language transformations) that can be used to create both simple and complex scripts.
If the age of client-server computing was all about the development of logic and applications for single-purpose processing systems, then the Internet-enabled enterprise is all about data flow between such systems. XML and, by extension, schemas become the linchpins in this new enterprise, enabling the secure flow of valid data between loosely coupled systems.
To this end, several companies are trying to enable schema structure to work more closely with applications and databases. Tibco, Palo Alto, CA, for one, has been advancing Schema Adjunct Framework (SAF), a structure whereby developers could augment schemas with related database mappings and application logic. With this approach, the portion of a schema that deals with name and address elements, for example, could include adjuncts that detail how the name element in the XML schema maps to a name field in a relational database. Microsoft has a similar notion of schema "adornment," but Tibco's thinking seems to be further along; it is now working with other companies to round out the proposed approach and will advance the proposal with one of the industry standards groups.
Organizations don't have to wait for SAF to make schemas a central piece of their infrastructure. Schemas answer all kinds of practical problems now and answer them well. This is especially true if your organization is also equipped to build the transformation tools to map XML data from one schema to another. Taken together, XML schemas and transformation tools will form the underpinnings of the best new enterprises.
Bill Trippe(btrippe@nmpub.com) is president of New Millennium Publishing (www.nmpub.com), Boston.
|
|