XML Schema (W3C)

XML Schema (W3C)

dablink|This article is about the W3C's XML Schema language. For information about XML schema languages in general, see XML schema

infobox file format
name = XML Schema (W3C)
extension = .xsd
mime = application/xml, text/xml
owner = [http://www.w3.org/ World Wide Web Consortium]
genre = Schema language
extendedfrom = XML
standard = [http://www.w3.org/TR/xmlschema-1/ 1.0, Part 1 Structures (Recommendation)] ,
[http://www.w3.org/TR/xmlschema-2/ 1.0, Part 2 Datatypes (Recommendation)] ,
[http://www.w3.org/TR/xmlschema11-1/ 1.1, Part 1 Structures (Draft)] ,
[http://www.w3.org/TR/xmlschema11-2/ 1.1, Part 2 Datatypes (Draft)]

XML Schema, published as a W3C recommendation in May 2001, is one of several XML schema languages. It was the first separate schema language for XML to achieve Recommendation status by the W3C. Like all XML schema languages, XML Schema can be used to express a schema: a set of rules to which an XML document must conform in order to be considered 'valid' according to that schema. However, unlike most other schema languages, XML Schema was also designed with the intent that determination of a document's validity would produce a collection of information adhering to specific data types. Such a post-validation "infoset" can be useful in the development of XML document processing software, but the schema language's dependence on specific data types has provoked criticism.

An XML Schema instance is an XML Schema Definition (XSD) and typically has the filename extension ".xsd". The language itself is sometimes informally referenced as XSD. It has been suggested that WXS (for W3C XML Schema) is a more appropriate initialism [The W3C Working Group that developed the language deliberately avoided creating an initialism so that people would refer to the language simply as XML Schema. However, some people in the technology industry have a fondness for three- and four-letter initialisms, and "DTD" was already in general use to refer to both a Document Type Definition and the "language" — actually an unnamed portion of the markup languages XML or SGML — in which a DTD is written. Of the two most common XML Schema initialisms, XSD and WXS, XSD is relatively ubiquitous. However, the W3C has not given its blessing to either one, and a number of XML professionals, in postings on electronic mailing lists such as xml-dev and in articles published in online trade journals like XML.com, advocate referring to the language as WXS or W3C XML Schema.] though this acronym has not been in a widespread use and W3C working group rejected it. XSD is also an initialism for XML Schema Datatypes, the datatype portion of XML Schema.

History

In its appendix of references, XML Schema acknowledges the influence of DTD and other early XML schema efforts such as DDML, SOX, XML-Data, and XDR. It appears to have picked pieces from each of these proposals but is also a compromise among them. Of those languages, XDR and SOX continued to be used and supported for a while after XML Schema was published. A number of Microsoft products supported XDR until the release of MSXML 4.0 (which dropped XDR in favor of XML Schema) in October 2001. Commerce One, Inc. supported its SOX schema language until declaring bankruptcy in late 2004.

Post-Schema-Validation Infoset

After XML Schema-based validation, it is possible to express an XML document's structure and content in terms of the data model that was implicit during validation. The XML Schema data model includes:
* the vocabulary (element and attribute names)
* the content model (relationships and structure)
* the data types.This collection of information is called the Post-Schema-Validation Infoset (PSVI). The PSVI gives a valid XML document its "type" and facilitates treating the document as an object, using object-oriented programming (OOP) paradigms.

This particular OOP approach to XML data access was primarily advocated by Microsoft, a major contributor to the development of XML Schema. Converting an XML document to a datatype-aware object can be beneficial in some parts of computer software design, but critics contend that it also undermines openness, a key feature of XML, and that it is biased toward compatibility with the datatypes native to Microsoft's favored programming languages. [ [http://www.biglist.com/lists/xsl-list/archives/200302/msg00821.html Re: [xsl The Perils of Sudden Type-Safety in XPath 2.0 ] ]

In addition, the limitations inherent to (and caused by) XML Schema datatypes, the restrictive coupling of those datatypes with the rest of XML Schema, and dependencies on those datatypes in other W3C specifications are points of contention among a number of XML software developers. [ [http://www.oreillynet.com/pub/wlg/2511?wlg=yes More on XML class warfare - O'Reilly ONLamp Blog ] ]

Data types

Data types in XML Schema are classified into built-in data types and user-defined data types.

There are 19 built-in primitive data types and 25 built-in derived data types specified. They represent common data types such as string, integer, decimal and date.

Example

An example of a very simple XML Schema Definition to describe a country is given below.

An example of an XML document that conforms to this schema is given below (assuming the schema file name is "country.xsd").

France 64473140

XML Schema Definition

An XML Schema Definition (XSD) is an instance of an XML schema written in XML Schema. An XSD defines a type of XML document in terms of constraints upon what elements and attributes may appear, their relationship to each other, what types of data may be in them, and other things. It can be used with validation software in order to ascertain whether a particular XML document is of that type, and to produce a PSVI.

XSDs were the first W3C-recommended XML schemas to provide a namespace and datatype aware alternative to using XML's native Document Type Definitions (DTDs).

XML Schema Definition files usually have the filename extension ".xsd". A unique Internet Media Type is not yet registered for XSDs, so "application/xml" or "text/xml" should be used, as per RFC 3023.

ee also

*XML Schema Language Comparison - Comparison to other XML Schema languages.
*RELAX NG - another XML schema language (an ISO international standard) that is often used with XML Schema datatypes
*List of XML Schemas - list of XML schemas in use on the Internet sorted by purpose

References

External links

W3C XML Schema Specification
* [http://www.w3.org/TR/xmlschema-0/ Primer]
* [http://www.w3.org/TR/xmlschema-1/ Structures]
* [http://www.w3.org/TR/xmlschema-2/ Datatypes]
* [http://www.w3.org/XML/Schema#Tools Tools] Tutorials
* [http://xmlzoo.net/xsd/ Interactive XML Schema tutorial]
* [http://www.w3schools.com/schema/default.asp W3Schools XML Schema Tutorial]
* [http://www.codalogic.com/lmx/xsd-overview.html A Simple Overview of W3C Schema]


Wikimedia Foundation. 2010.

Игры ⚽ Поможем написать курсовую

Look at other dictionaries:

  • XML Schema (W3C) — XML Schema один из языков описания структуры XML Schema получила статус рекомендации Консорциума W3C 2 мая 2001 года, став первым стандартом описания XML, получившим статус рекомендации. Как большинство языков описания XML, XML Schema была… …   Википедия

  • XML Schema Language Comparison — An XML schema is a description of a type of XML document, typically expressed in terms of constraints on the structure and content of documents of that type, above and beyond the basic syntax constraints imposed by XML itself. There are several… …   Wikipedia

  • XML schema — An XML schema is a description of a type of XML document, typically expressed in terms of constraints on the structure and content of documents of that type, above and beyond the basic syntactical constraints imposed by XML itself. An XML schema… …   Wikipedia

  • XML-Schema — ist eine Empfehlung des W3C zum Definieren von Strukturen für XML Dokumente. Anders als bei den klassischen XML DTDs wird die Struktur in Form eines XML Dokuments beschrieben. Darüber hinaus wird eine große Anzahl von Datentypen unterstützt.… …   Deutsch Wikipedia

  • XML Schema Definition — XML Schema ist eine Empfehlung des W3C zum Definieren von Strukturen für XML Dokumente. Anders als bei den klassischen XML DTDs wird die Struktur in Form eines XML Dokuments beschrieben. Darüber hinaus wird eine große Anzahl von Datentypen… …   Deutsch Wikipedia

  • XML Schema — XML Schema, abgekürzt XSD, ist eine Empfehlung des W3C zum Definieren von Strukturen für XML Dokumente. Anders als bei den klassischen XML DTDs wird die Struktur in Form eines XML Dokuments beschrieben. Darüber hinaus wird eine große Anzahl von… …   Deutsch Wikipedia

  • XML Schema — publié comme recommandation par le W3C en mai 2001 est un langage de description de format de document XML permettant de définir la structure et le type de contenu d un document XML. Cette définition permet notamment de vérifier la validité de ce …   Wikipédia en Français

  • XML Schema — es un lenguaje de esquema utilizado para describir la estructura y las restricciones de los contenidos de los documentos XML de una forma muy precisa, más allá de las normas sintácticas impuestas por el propio lenguaje XML. Se consigue así una… …   Wikipedia Español

  • XML Schema — XML Schema  язык описания структуры XML документа. Спецификация XML Schema является рекомендацией W3C. Как большинство языков описания XML, XML Schema была задумана для определения правил, которым должен подчиняться документ. Но, в отличие… …   Википедия

  • XML Schéma — XML Schema XML Schema publié comme recommandation par le W3C en mai 2001 est un langage de description de format de document XML permettant de définir la structure d un document XML. La connaissance de la structure d un document XML permet… …   Wikipédia en Français

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”