XML Schemas Get the NodNow that XML Schemas have reached final recommendation status, they are more attractive than DTDsBy Solomon H. Simon In spite of the kick-start that B2B e-commerce provided for XML, many companies held back because of their perception that XML lacked standards. But now that XML Schemas have been given final recommendation status by the World Wide Web Consortium (W3C), that resistance can start to subside. This status is tantamount to making XML Schemas a metadata standard and a valid alternative to Document Type Definitions (DTDs). With the general acceptance and use of schemas, companies will be ready to kick their XML communications and data interchange efforts into high gear. XML Schemas greatly simplify the use of XML in business applications because they follow XML format, enable data reuse, are compatible with extensible stylesheet language transformations, and are simpler compared to DTDs. DTDS: THE METADATA FOR XMLA team of standardized general markup language (SGML) experts, who wanted to build a general markup language that was smaller than SGML so that it would be portable across the Web, developed XML. They borrowed DTDs from the original SGML syntax to help maintain compatibility between XML and SGML, and the first XML applications and parsers were derived from existing SGML applications. DTDs are the metadata for XML and serve as the foundation of XML documents and applications. A DTD contains the rules for writing an XML Web page and for instructing a browser on how to process it. The DTD designates valid syntax, structure, and format for defining the markup elements for an XML document. It helps a parser to process an XML document, identifying important information, mandatory information, and optional information. The DTD also identifies where elements appear and how they are related.
The author of an XML document uses a DTD the same way a construction worker uses a blueprint. The DTD provides a list of elements, rules, and specifications that define a content model for a category of documents. WHAT IS A SCHEMA?A schema is the XML construct used to represent the data elements, attributes, and their relationships as defined in the data model. By definition, a DTD and a schema are very similar. However, DTDs usually define simple, abstract text relationships, while schemas define more complex and concrete data and application relationships. A DTD doesn't use a hierarchical formation, while a schema uses a hierarchical structure to indicate relationships. The XML Schema standard uses the XML syntax exclusively, rather than borrowing from SGML, and it will augment, then later supplant, DTDs. An XML document follows two syntax rules. First, if a document follows the general rules of XML, then it is well formed. If the document has a DTD or schema and follows the specific rules in the DTD or schema, then it conforms to the XML specification and it is considered valid. An important characteristic of DTD-based valid XML documents is that they are also compatible with SGML and can be processed by most SGML tools. Document validity results in language compatibility. DTDs and schemas define the metadata of an XML document, represented by the XML tags. When developers create a new XML document, they don't know how to proceed, and they are like tourists in a new city without a road map. The metadata (DTD or schema) acts as a tourist information center that provides complete information on what path to follow to arrive at the desired destination. DTDS VS. SCHEMAS: WHAT'S THE DIFFERENCE?Both DTDs and schemas represent the metadata for an XML document. However, the structure of the two constructs is very different. Consider the following DTD snippet for a book: < !ELEMENT book (title, author+, ISBN, price)> < !ELEMENT author (first, last)> < !ELEMENT title (#PCDATA)> < !ELEMENT isbn (#PCDATA)> < !ELEMENT price (#PCDATA)> < !ELEMENT first (#PCDATA)> < !ELEMENT last (#PCDATA)> In this example, the basic information about a book is defined, along with rules for how elements are related. The first line indicates that a book has a title, author, ISBN, and price associated with it. The "+" indicates that an element, author in this case, must exist and may occur in multiple instances. The next line implies that an author has a first and last name. The next five lines indicate that title, ISBN, price, first, and last are character data. (PCDATA stands for parsed character data.)
|
Most Popular This Week
IE Weekly Newsletter
Subscribe to the newsletter
|
|
|











