Jump to content
 







Main menu
   


Navigation  



Main page
Contents
Current events
Random article
About Wikipedia
Contact us
Donate
 




Contribute  



Help
Learn to edit
Community portal
Recent changes
Upload file
 








Search  

































Create account

Log in
 









Create account
 Log in
 




Pages for logged out editors learn more  



Contributions
Talk
 



















Contents

   



(Top)
 


1 History  





2 Schemas and schema documents  





3 Schema components  





4 Types  





5 Post-Schema-Validation Infoset  





6 Secondary uses for XML Schemas  



6.1  Code generation  





6.2  Generation of XML file structure documentation  







7 Criticism  





8 Version 1.1  





9 See also  





10 References  





11 Further reading  





12 External links  














XML Schema (W3C)






Български
Català
Čeština
Dansk
Deutsch
Español
Esperanto
Français

Hrvatski
Interlingua
Italiano
עברית
Magyar
Nederlands

Norsk bokmål
Norsk nynorsk
Polski
Português
Русский
Suomi
Svenska
Türkçe
Українська

 

Edit links
 









Article
Talk
 

















Read
Edit
View history
 








Tools
   


Actions  



Read
Edit
View history
 




General  



What links here
Related changes
Upload file
Special pages
Permanent link
Page information
Cite this page
Get shortened URL
Download QR code
Wikidata item
 




Print/export  



Download as PDF
Printable version
 




In other projects  



Wikiversity
 
















Appearance
   

 






From Wikipedia, the free encyclopedia
 

(Redirected from XSD)

XML Schema (W3C)
Filename extension
.xsd
Internet media type
application/xml, text/xml
Developed byWorld Wide Web Consortium
Type of formatXML Schema language
Extended fromXML
Standard1.0, Part 1 Structures (Recommendation),

1.0, Part 2 Datatypes (Recommendation),
1.1, Part 1 Structures (Recommendation),

1.1, Part 2 Datatypes (Recommendation)

XSD (XML Schema Definition), a recommendation of the World Wide Web Consortium (W3C), specifies how to formally describe the elements in an Extensible Markup Language (XML) document. It can be used by programmers to verify each piece of item content in a document, to assure it adheres to the description of the element it is placed in.[1]

Like all XML schema languages, XSD can be used to express a set of rules to which an XML document must conform to be considered "valid" according to that schema. However, unlike most other schema languages, XSD 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.

History[edit]

XML Schema, published as a W3C recommendation in May 2001,[2] is one of several XML schema languages. It was the first separate schema language for XML to achieve Recommendation status by the W3C. Because of confusion between XML Schema as a specific W3C specification, and the use of the same term to describe schema languages in general, some parts of the user community referred to this language as WXS, an initialism for W3C XML Schema, while others referred to it as XSD, an initialism for XML Schema Definition.[3][4] In Version 1.1 the W3C has chosen to adopt XSD as the preferred name, and that is the name used in this article.

In its appendix of references, the XSD specification acknowledges the influence of DTDs and other early XML schema efforts such as DDML, SOX, XML-Data, and XDR. It has adopted features 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 6.0 (which dropped XDR in favor of XML Schema) in December 2006.[5] Commerce One, Inc. supported its SOX schema language until declaring bankruptcy in late 2004.

The most obvious features offered in XSD that are not available in XML's native Document Type Definitions (DTDs) are namespace awareness and datatypes, that is, the ability to define element and attribute content as containing values such as integers and dates rather than arbitrary text.

The XSD 1.0 specification was originally published in 2001, with a second edition following in 2004 to correct large numbers of errors. XSD 1.1 became a W3C RecommendationinApril 2012.

Schemas and schema documents[edit]

Technically, a schema is an abstract collection of metadata, consisting of a set of schema components: chiefly element and attribute declarations and complex and simple type definitions. These components are usually created by processing a collection of schema documents, which contain the source language definitions of these components. In popular usage, however, a schema document is often referred to as a schema.

Schema documents are organized by namespace: all the named schema components belong to a target namespace, and the target namespace is a property of the schema document as a whole. A schema document may include other schema documents for the same namespace, and may import schema documents for a different namespace.

When an instance document is validated against a schema (a process known as assessment), the schema to be used for validation can either be supplied as a parameter to the validation engine, or it can be referenced directly from the instance document using two special attributes, xsi:schemaLocation and xsi:noNamespaceSchemaLocation. (The latter mechanism requires the client invoking validation to trust the document sufficiently to know that it is being validated against the correct schema. "xsi" is the conventional prefix for the namespace "http://www.w3.org/2001/XMLSchema-instance".)

XML Schema Documents 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.

Schema components[edit]

The main components of a schema are:

Other more specialized components include annotations, assertions, notations, and the schema component which contains information about the schema as a whole.

Types[edit]

Simple types (also called data types) constrain the textual values that may appear in an element or attribute. This is one of the more significant ways in which XML Schema differs from DTDs. For example, an attribute might be constrained to hold only a valid date or a decimal number.

XSD provides a set of 19 primitive data types (anyURI, base64Binary, boolean, date, dateTime, decimal, double, duration, float, hexBinary, gDay, gMonth, gMonthDay, gYear, gYearMonth, NOTATION, QName, string, and time). It allows new data types to be constructed from these primitives by three mechanisms:

Twenty-five derived types are defined within the specification itself, and further derived types can be defined by users in their own schemas.

The mechanisms available for restricting data types include the ability to specify minimum and maximum values, regular expressions, constraints on the length of strings, and constraints on the number of digits in decimal values. XSD 1.1 again adds assertions, the ability to specify an arbitrary constraint by means of an XPath 2.0 expression.

Complex types describe the permitted content of an element, including its element and text children and its attributes. A complex type definition consists of a set of attribute uses and a content model. Varieties of content model include:

A complex type can be derived from another complex type by restriction (disallowing some elements, attributes, or values that the base type permits) or by extension (allowing additional attributes and elements to appear). In XSD 1.1, a complex type may be constrained by assertions—XPath 2.0 expressions evaluated against the content that must evaluate to true.

Post-Schema-Validation Infoset[edit]

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:

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.

Secondary uses for XML Schemas[edit]

The primary reason for defining an XML schema is to formally describe an XML document; however the resulting schema has a number of other uses that go beyond simple validation.

Code generation[edit]

The schema can be used to generate code, referred to as XML Data Binding. This code allows contents of XML documents to be treated as objects within the programming environment.

Generation of XML file structure documentation[edit]

The schema can be used to generate human-readable documentation of an XML file structure; this is especially useful where the authors have made use of the annotation elements. No formal standard exists for documentation generation, but a number of tools are available, such as the Xs3p stylesheet, that will produce high-quality readable HTML and printed material.

Criticism[edit]

Although XML Schema is successful in that it has been widely adopted and largely achieves what it set out to, it has been the subject of a great deal of severe criticism, perhaps more so than any other W3C Recommendation. Good summaries of the criticisms are provided by James Clark,[6] Anders Møller and Michael Schwartzbach,[7] Rick Jelliffe[8] and David Webber.[9]

General problems:

Practical limitations of expressibility:

Technical problems:

Version 1.1[edit]

XSD 1.1 became a W3C RecommendationinApril 2012, which means it is an approved W3C specification.

Significant new features in XSD 1.1 are:

Until the Proposed Recommendation draft, XSD 1.1 also proposed the addition of a new numeric data type, precisionDecimal. This proved controversial, and was therefore dropped from the specification at a late stage of development.

See also[edit]

References[edit]

  1. ^ "Definition XSD (XML Schema Definition)" TechTarget, retrieved 10 June 2014
  • ^ "XML and Semantic Web W3C Standards Timeline" (PDF). 2012-02-04.
  • ^ See Schema - W3C
  • ^ See W3C XML Schema Definition Language (XSD) 1.1 Part 1: Structures
  • ^ "Removal of XDR Schema Support in MSXML 6.0". Retrieved 2010-09-19.
  • ^ James Clark summary of XML Schema criticisms, and promotion of RELAX NG as an alternative, https://web.archive.org/web/20150316212413/http://www.imc.org/ietf-xml-use/mail-archive/msg00217.html
  • ^ Anders Møller and Michael I. Schwartzbach presents "Problems with XML Schema", http://cs.au.dk/~amoeller/XML/schemas/xmlschema-problems.html
  • ^ Rick Jelliffe critique in May 2009, https://web.archive.org/web/20090516232816/http://broadcast.oreilly.com/2009/05/w3c-please-put-xsd-11-on-hold.html
  • ^ David Webber OASIS comparison and insights white paper from August 2008, http://www.oasis-open.org/committees/download.php/29164/White%20Paper%20on%20CAM%20and%20XSD.pdf
  • ^ This point is amplified by Uche Ogbuji More on XML class warfare - O'Reilly ONLamp Blog
  • Further reading[edit]

    External links[edit]

    W3C XML Schema 1.0 Specification

    W3C XML Schema 1.1 Specification

    Other


    Retrieved from "https://en.wikipedia.org/w/index.php?title=XML_Schema_(W3C)&oldid=1213383199"

    Categories: 
    World Wide Web Consortium standards
    XML-based standards
    Hidden categories: 
    Articles with short description
    Short description matches Wikidata
    Articles with Curlie links
    Articles with GND identifiers
     



    This page was last edited on 12 March 2024, at 18:42 (UTC).

    Text is available under the Creative Commons Attribution-ShareAlike License 4.0; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy. Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc., a non-profit organization.



    Privacy policy

    About Wikipedia

    Disclaimers

    Contact Wikipedia

    Code of Conduct

    Developers

    Statistics

    Cookie statement

    Mobile view



    Wikimedia Foundation
    Powered by MediaWiki