XmlSchema is also commonly known as WXS (W3C XML Schema). It is the first of many XML-specific SchemaLanguagesForXml, designed to overcome DocumentTypeDefinition (DTD) shortcomings. The specification has two parts: * Part 1 on structures: See http://www.w3.org/TR/xmlschema-1/ * Part 2 on datatypes: See http://www.w3.org/TR/xmlschema-2/ An instance (and file extension) for this WXS version of the schema for ExtensibleMarkupLanguage is XmlSchemaDefinition (XSD). XML Schema not only addresses the structure of the document, but also addresses datatypes. Built-in datatypes include string, date, time, duration of time, decimal, integer, float, double, boolean, etc. Also, you can derive your own datatypes. For instance, you could constrain the contents of the element to five (or nine) digits. ---- An Example of XmlSchema in action: A simple instance document: AlbertEinstein E=mc^2 ThomasEdison Lightbulb, Phonograph BenjaminFranklin Bifocals, Lightning is an electrical phenomenon, DayTimer An XmlSchema document that describes the above instance: A not obvious benefit of this particular XmlSchema is it will also validate documents with a different root element, provided they match the schema. For instance, the following document is also valid: WardCunningham Inventor of the Wiki Although this modular behavior can be very handy, it might not be what you want. You can rewrite the schema to forbid this type of behavior. ---- When do you write a schema? Only if you want to share a common definition with others (customers, developers, ...)? For the sake of verifying schema conformance? Why do I need a schema if I still need a program that '''knows''' what to do with the XML content? Can I automatically generate a database schema from an XML schema? ''Schema are useful to make sure that all the users of a particular data set are playing by the same rules when transporting the data. XML is a storage and transport mechanism, ''not'' a means to verify the content of the data in its real context. In other words, schema are good for verifying that an integer is an integer, but not that the value is correct when compared to other values in the system.'' ''One of my (stationary, on-hold) projects is a video test pattern generator design that uses XML to tell the generator how to establish a pattern. Each of the pattern parameters can be tested via schema to see if it makes sense, but a large number of parameters are interdependent. Only the application (the generator) knows the actual relationship of the parameters to each other; the schema can only know if they are the right type and within a certain range. In this case the transport mechanism (XML) is responsible only for making sure the data didn't get garbled from source to sink. The application still needs to compare all the data against itself ''in context'' to know if it is usable.'' ''This does not mean that the XML schema is useless or redundant. It only means that the appropriate mechanism must be employed to guarantee data integrity at the level of examination under discussion.'' ---- '''Role of XmlSchema has changed''' ''Reference article Oct2003 from ZapThink: http://searchwebservices.techtarget.com/tip/1,289483,sid26_gci931774,00.html '' * It has been re-invented to serve to assist with the discovery of WebServices, in conjunction with WSDL. ---- See Also: SchemaLanguagesForXml, ProcessingMarkupLanguages ---- CategoryXml CategorySemanticWeb