Play Video
1
Use Trang to Generate XML Schema
Use Trang to Generate XML Schema
::2012/06/30::
Play Video
2
Learn XML Schema Tutorial Part 4
Learn XML Schema Tutorial Part 4
::2010/05/09::
Play Video
3
XML Tutorial for beginners video. Learn XML basics programming tutorial. How to create XML file
XML Tutorial for beginners video. Learn XML basics programming tutorial. How to create XML file
::2012/10/02::
Play Video
4
XML Tutorial   31 XML Schema Basics
XML Tutorial 31 XML Schema Basics
::2013/02/18::
Play Video
5
XML Tutorial   33 XSD Schema Elements
XML Tutorial 33 XSD Schema Elements
::2013/02/18::
Play Video
6
JET Messaging Technologies - The XML Library Company
JET Messaging Technologies - The XML Library Company
::2014/06/03::
Play Video
7
Comparison among different schema languages_Part1.wmv
Comparison among different schema languages_Part1.wmv
::2011/08/25::
Play Video
8
Comparison among different schema languages_Part2.wmv
Comparison among different schema languages_Part2.wmv
::2011/08/25::
Play Video
9
SOAP, WSDL, HTTP, XML, XSD, DTD, UDDI....what the? - Part 1
SOAP, WSDL, HTTP, XML, XSD, DTD, UDDI....what the? - Part 1
::2010/07/21::
Play Video
10
44 XML.Essential.Training elements (Creating XML Schema Definitions)
44 XML.Essential.Training elements (Creating XML Schema Definitions)
::2014/02/26::
Play Video
11
46 XML.Essential.Training define (Creating XML Schema Definitions)
46 XML.Essential.Training define (Creating XML Schema Definitions)
::2014/02/26::
Play Video
12
XMLSeed XML Sample Generator
XMLSeed XML Sample Generator
::2013/07/08::
Play Video
13
XML Tutorial   26 DTD Schema Element Options
XML Tutorial 26 DTD Schema Element Options
::2013/02/18::
Play Video
14
XML Tutorial   7 XML & W3C Standard
XML Tutorial 7 XML & W3C Standard
::2013/02/18::
Play Video
15
XML Schema 1.1 Support in oXygen XML - oXygen Users Meetup - XMLPrague 2013
XML Schema 1.1 Support in oXygen XML - oXygen Users Meetup - XMLPrague 2013
::2013/03/01::
Play Video
16
XML Tutorial   29 DTD Schema Data Types
XML Tutorial 29 DTD Schema Data Types
::2013/02/18::
Play Video
17
Learn XML Tutorial Part 1
Learn XML Tutorial Part 1
::2010/05/09::
Play Video
18
Mukund Balasubramanian , CTO Photon Infotech
Mukund Balasubramanian , CTO Photon Infotech
::2010/03/12::
Play Video
19
45 XML.Essential.Training attributes (Creating XML Schema Definitions)
45 XML.Essential.Training attributes (Creating XML Schema Definitions)
::2014/02/26::
Play Video
20
XML Tutorial   24 DTD Schema Basics
XML Tutorial 24 DTD Schema Basics
::2013/02/18::
Play Video
21
42 XML.Essential.Training schema (Creating XML Schema Definitions)
42 XML.Essential.Training schema (Creating XML Schema Definitions)
::2014/02/25::
Play Video
22
43 XML.Essential.Training anatomy (Creating XML Schema Definitions)
43 XML.Essential.Training anatomy (Creating XML Schema Definitions)
::2014/02/25::
Play Video
23
XML Tutorial   23 Well Formed & Valid DTD Schemas
XML Tutorial 23 Well Formed & Valid DTD Schemas
::2013/02/18::
Play Video
24
HTML W3C Tutorial Pt 1
HTML W3C Tutorial Pt 1
::2010/03/13::
Play Video
25
W3C Digging the XML Grave
W3C Digging the XML Grave
::2008/06/27::
Play Video
26
Liam Quin: Future of XML at W3C (XMLPrague 2010)
Liam Quin: Future of XML at W3C (XMLPrague 2010)
::2011/12/14::
Play Video
27
XML (Einführung) | Informatik Lernvideo
XML (Einführung) | Informatik Lernvideo
::2014/01/27::
Play Video
28
Michael Sperberg-McQueen: The View from Prague. The closing keynote of XML Prague 2010.
Michael Sperberg-McQueen: The View from Prague. The closing keynote of XML Prague 2010.
::2011/12/14::
Play Video
29
What is XML?
What is XML?
::2013/08/10::
Play Video
30
CAMV XML Rules Validation Engine Tutorial and Test Suite Development
CAMV XML Rules Validation Engine Tutorial and Test Suite Development
::2012/11/05::
Play Video
31
xpath in xml
xpath in xml
::2013/08/10::
Play Video
32
XML: 03 Espacio de nombres
XML: 03 Espacio de nombres
::2014/06/18::
Play Video
33
XML Explained (Arabic)
XML Explained (Arabic)
::2008/04/05::
Play Video
34
HTML W3C Tutorial Pt 2
HTML W3C Tutorial Pt 2
::2010/03/13::
Play Video
35
Et tu, XML? The fall of the relational empire.
Et tu, XML? The fall of the relational empire.
::2008/05/26::
Play Video
36
Prince XML: Generating High Quality PDFs from HTML + CSS
Prince XML: Generating High Quality PDFs from HTML + CSS
::2007/11/15::
Play Video
37
Basic XML X-Query
Basic XML X-Query
::2013/04/24::
Play Video
38
Chapter 11(5) - Querying XML data using XQuery
Chapter 11(5) - Querying XML data using XQuery
::2012/09/14::
Play Video
39
Lisa Rein Interview With EthicsInTech at Internet Archives For Aaron Swartz Memorial
Lisa Rein Interview With EthicsInTech at Internet Archives For Aaron Swartz Memorial
::2013/11/15::
Play Video
40
7  How to Generate XML file from excel ITR utility (Explained step by step )  (INDIA SPECIFIC )
7 How to Generate XML file from excel ITR utility (Explained step by step ) (INDIA SPECIFIC )
::2013/07/28::
Play Video
41
HTML W3C Tutorial Pt 3
HTML W3C Tutorial Pt 3
::2010/03/13::
Play Video
42
XML: Introducción
XML: Introducción
::2011/11/14::
Play Video
43
XML Prague 2014, Sunday Feb 16
XML Prague 2014, Sunday Feb 16
::2014/02/17::
Play Video
44
XML Prague 2012 - eXist-db pre-conference - Erik Siegel - Software Management
XML Prague 2012 - eXist-db pre-conference - Erik Siegel - Software Management
::2012/02/14::
Play Video
45
Walsh & Berjon: XML and HTML Cross-Pollination: A Bridge Too Far?  (XMLPrague 2012)
Walsh & Berjon: XML and HTML Cross-Pollination: A Bridge Too Far? (XMLPrague 2012)
::2012/05/27::
Play Video
46
Search Engine Optimisation: Why is W3c Compliance Important?
Search Engine Optimisation: Why is W3c Compliance Important?
::2007/09/26::
Play Video
47
XML: HTML y XHTML
XML: HTML y XHTML
::2011/11/14::
Play Video
48
Digital Signature Utility for XML-based Documents
Digital Signature Utility for XML-based Documents
::2008/03/08::
Play Video
49
XML Tutorial   2 Prerequisites & Setup
XML Tutorial 2 Prerequisites & Setup
::2013/02/18::
Play Video
50
HTML, XHTML and XML
HTML, XHTML and XML
::2011/06/23::
NEXT >>
RESULTS [51 .. 101]
From Wikipedia, the free encyclopedia
Jump to: navigation, search
XML Schema (W3C)
Filename extension .xsd
Internet media type application/xml, text/xml
Developed by World Wide Web Consortium
Type of format XML Schema language
Extended from XML
Standard

1.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. They can check 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 in order 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. However, the schema language's dependence on specific data types has provoked criticism.

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 Recommendation in April 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:

  • Element declarations, which define properties of elements. These include the element name and target namespace. An important property is the type of the element, which constrains what attributes and children the element can have. In XSD 1.1, the type of the element may be conditional on the values of its attributes. An element may belong to a substitution group; if element E is in the substitution group of element H, then wherever the schema permits H to appear, E may appear in its place. Elements may have integrity constraints: uniqueness constraints determining that particular values must be unique within the subtree rooted at an element, and referential constraints determining that values must match the identifier of some other element. Element declarations may be global or local, allowing the same name to be used for unrelated elements in different parts of an instance document.
  • Attribute declarations, which define properties of attributes. Again the properties include the attribute name and target namespace. The attribute type constrains the values that the attribute may take. An attribute declaration may also include a default value or a fixed value (which is then the only value the attribute may take.)
  • Simple and complex types. These are described in the following section.
  • Model group and attribute group definitions. These are essentially macros: named groups of elements and attributes that can be reused in many different type definitions.
  • An attribute use represents the relationship of a complex type and an attribute declaration, and indicates whether the attribute is mandatory or optional when it is used in that type.
  • An element particle similarly represents the relationship of a complex type and an element declaration, and indicates the minimum and maximum number of times the element may appear in the content. As well as element particles, content models can include model group particles, which act like non-terminals in a grammar: they define the choice and repetition units within the sequence of permitted elements. In addition, wildcard particles are allowed, which permit a set of different elements (perhaps any element provided it is in a certain namespace).

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

Types[edit]

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 element-only content, in which no text may appear (other than whitespace, or text enclosed by a child element); simple content, in which text is allowed but child elements are not; empty content, in which neither text nor child elements are allowed; and mixed content, which permits both elements and text to appear. 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.

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:

  • restriction (reducing the set of permitted values),
  • list (allowing a sequence of values), and
  • union (allowing a choice of values from several types).

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.

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:

  • 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.

Example[edit]

This is an example of a rather simple schema document to describe an address.

<?xml version="1.0" encoding="utf-8"?>
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="Address">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Recipient" type="xs:string" />
        <xs:element name="House" type="xs:string" />
        <xs:element name="Street" type="xs:string" />
        <xs:element name="Town" type="xs:string" />
        <xs:element name="County" type="xs:string" minOccurs="0" />
        <xs:element name="PostCode" type="xs:string" />
        <xs:element name="Country" minOccurs="0">
          <xs:simpleType>
            <xs:restriction base="xs:string">
              <xs:enumeration value="IN" />
              <xs:enumeration value="DE" />
              <xs:enumeration value="ES" />
              <xs:enumeration value="UK" />
              <xs:enumeration value="US" />
            </xs:restriction>
          </xs:simpleType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

A number of development tools can be used to create a graphical representation of a schema. Many of them create diagrams similar to the one shown below:

A graphical representation of the schema code above

An example of an XML document that conforms to this schema

<?xml version="1.0" encoding="utf-8"?>
<Address xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="SimpleAddress.xsd">
  <Recipient>Mr. Walter C. Brown</Recipient>
  <House>49</House>
  <Street>Featherstone Street</Street>
  <Town>LONDON</Town>
  <PostCode>EC1Y 8SY</PostCode>
  <Country>UK</Country>
</Address>

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:

  • It is too complicated (the spec is several hundred pages in a very technical language), so it is hard to use by non-experts – but many non-experts need schemas to describe data formats. The W3C Recommendation itself is extremely difficult to read. Most users find W3Cs XML Schema Primer much easier to understand.
  • XSD lacks any formal mathematical specification. (This makes it difficult to reason about schemas, for example to prove that a modification to a schema is backwards compatible)
  • There are many surprises in the language, for example that restriction of elements works differently from restriction of attributes.

Practical limitations of expressibility:

  • XSD offers very weak support for unordered content.
  • XSD cannot require a specific root element (so extra information is required to validate even the simplest documents).
  • When describing mixed content, the character data cannot be constrained in any way (not even a set of valid characters can be specified).
  • Content and attribute declarations cannot depend on attributes or element context (this was also listed as a central problem of DTD).
  • It is not 100% self-describing (as a trivial example, see the previous point), even though that was an initial design requirement.
  • Defaults cannot be specified separately from the declarations (this makes it hard to make families of schemas that only differ in the default values); element defaults can only be character data (not containing markup).

Technical problems:

  • Although it technically is namespace-conformant, it does not seem to follow the namespace spirit (e.g. "unqualified locals").
  • XSD 1.0 provided no facilities to state that the value or presence of one attribute is dependent on the values or presence of other attributes (so-called co-occurrence constraints). This has been fixed in XSD 1.1.
  • The set of XSD datatypes on offer is highly arbitrary.[10]
  • The two tasks of validation and augmentation (adding type information and default values) should be kept separate.

Version 1.1[edit]

XSD 1.1 became a W3C Recommendation in April 2012, which means it is an approved W3C specification.

Significant new features in XSD 1.1 are:

  • The ability to define assertions against the document content by means of XPath 2.0 expressions (an idea borrowed from Schematron).
  • The ability to select the type against which an element will be validated based on the values of the element's attributes ("conditional type assignment").
  • Relaxing the rules whereby explicit elements in a content model must not match wildcards also allowed by the model.
  • The ability to specify wildcards (for both elements and attributes) that apply to all types in the schema, so that they all implement the same extensibility policy.

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]

Further reading[edit]

References[edit]

External links[edit]

W3C XML Schema 1.0 Specification

W3C XML Schema 1.1 Specification

Other

Wikipedia content is licensed under the GFDL License
Powered by YouTube
LEGAL
  • Mashpedia © 2014