XML Schema: Difference between revisions

The educational technology and digital learning wiki
Jump to navigation Jump to search
 
(13 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Stub}}
{{Incomplete}}


== Definition ==
== Definition ==


{{quotation | XML Schema: Structures specifies the XML Schema definition language, which offers facilities for describing the structure and constraining the contents of XML 1.0 documents, including those which exploit the XML Namespace facility. The schema language, which is itself represented in XML 1.0 and uses namespaces, substantially reconstructs and considerably extends the capabilities found in XML 1.0 document type definitions (DTDs).}}([http://www.w3.org/TR/xmlschema-1/ XML Schema Part 1: Structures Second Edition])
{{quotation | XML Schema: Structures specifies the XML Schema definition language, which offers facilities for describing the structure and constraining the contents of XML 1.0 documents, including those which exploit the [[XML namespace]] facility. The schema language, which is itself represented in XML 1.0 and uses namespaces, substantially reconstructs and considerably extends the capabilities found in XML 1.0 document type definitions (DTDs).}}([http://www.w3.org/TR/xmlschema-1/ XML Schema Part 1: Structures Second Edition])


{{quotation | An XML Schema consists of components such as type definitions and element declarations. These can be used to assess the validity of well-formed element and attribute information items (as defined in [XML-Infoset]), and furthermore may specify augmentations to those items and their descendants.}}([http://www.w3.org/TR/xmlschema-1/ XML Schema Part 1: Structures Second Edition])
{{quotation | An XML Schema consists of components such as type definitions and element declarations. These can be used to assess the validity of well-formed element and attribute information items (as defined in [XML-Infoset]), and furthermore may specify augmentations to those items and their descendants.}}([http://www.w3.org/TR/xmlschema-1/ XML Schema Part 1: Structures Second Edition])


XML Schema is considerably more complex than the Document Type Definition (DTD) and less elegant than [[Relax NG]]
XML Schema is considerably more complex, and provide a finer level of control, than the Document Type Definition (DTD) and less elegant than [[Relax NG]]
 
'''See also''': [[XML Schema tutorial - Basics]]


== Major components of XML Schema ==
== Major components of XML Schema ==
The main ingredients of an XML Schema are elements, types and attributes.
'''Elements''' : are declared with the <xsd:element> tag. They can have element-only, mixed, or empty of elements content. Elements can also be restricted to have certain values, i.e. types like:
* xs:string
* xs:decimal
* xs:integer
* xs:boolean
* xs:date
* xs:time
* etc.
Simple types can be combined into more complex types. A complex type can define elements, attributes or data types.
Complex elements are firstly used to define element order, e.g. :
* a sequence (appear in order)
* a choice (any element from a list)
* combined (can occur in any order)
'''Attributes''' are also defined within complex elements: any of the simple types can be used as attribute. The attribute can be optional, required or prohibited.
Read more in [[XML Schema tutorial - Basics]]
== Tools ==
=== Editors ===
* Most modern [[XML editor]]s can handle XML Schemas
=== DTD to XSD Conversion tools ===
; XML editors
* [[Exchanger XML Editor]] (free) can translate from XSD to DTD.
* ... there are other editors who can do conversion
; Online
* [http://www.hitsw.com/xml_utilites/ Online XML Utilities] from HitSoftware let's you convert a DTD (and the other way round) online (free of charge). Currently, registration is required and I didn't test this service anymore - [[User:Daniel K. Schneider|Daniel K. Schneider]] 16:49, 4 December 2010 (CET).
; Free tools that need some installation skills
* [http://www.lumrix.net/dtd2xs.php dtd2x] Free Java class. End users can lauch the class through an HTML page (tested on win XP).
* [http://www.thaiopensource.com/relaxng/trang.html Trang] (written by James Clark). Multi-format schema converter based on RELAX NG. Multiplatform Java-based. (Tested, works).
* [http://www.w3.org/2000/04/schema_hack/ A Conversion Tool from DTD to XML Schema]. Needs Perl installed. A slightly different version is at [http://www.mathling.com/xmlschema/ Mary Holstege]s website. (I tested both and they seem to work).
== In education ==
Certain [[educational modeling language]]s use XML Schema, e.g.
* [[eLML]]
* [[IMS]] and [[SCORM]] Standards, like [[IMS Content Packaging]] or [[IMS Simple Sequencing]]. Note: earlier versions of these standards used broken XSDs in order to be compatible with broken editors like XML Spy.
== Links ==
'''W3C XML Schema 1.0 Specification'''
*[http://www.w3.org/TR/xmlschema-0/ XSD 1.0 Primer]
*[http://www.w3.org/TR/xmlschema-1/ XSD 1.0 Structures]
*[http://www.w3.org/TR/xmlschema-2/ XSD 1.0 Datatypes]
*[http://www.w3.org/XML/Schema#Tools Tools]
'''W3C XML Schema 1.1 Specification'''
*[http://www.w3.org/TR/xmlschema11-1/ XSD 1.1 Structures]
*[http://www.w3.org/TR/xmlschema11-2/ XSD 1.1 Datatypes]
; Various
* [http://www.schemavalid.com/faq/xml-schema.html XML Schema FAQ]
* [http://en.wikipedia.org/wiki/XML_Schema_%28W3C%29 XML Schema (W3C)]


[[Category: XML]]
[[Category: XML]]
[[Category: Standards]]
[[Category: Standards]]
[[Category:web standards]]

Latest revision as of 20:17, 9 December 2010

Definition

“XML Schema: Structures specifies the XML Schema definition language, which offers facilities for describing the structure and constraining the contents of XML 1.0 documents, including those which exploit the XML namespace facility. The schema language, which is itself represented in XML 1.0 and uses namespaces, substantially reconstructs and considerably extends the capabilities found in XML 1.0 document type definitions (DTDs).”(XML Schema Part 1: Structures Second Edition)

“An XML Schema consists of components such as type definitions and element declarations. These can be used to assess the validity of well-formed element and attribute information items (as defined in [XML-Infoset]), and furthermore may specify augmentations to those items and their descendants.”(XML Schema Part 1: Structures Second Edition)

XML Schema is considerably more complex, and provide a finer level of control, than the Document Type Definition (DTD) and less elegant than Relax NG

See also: XML Schema tutorial - Basics

Major components of XML Schema

The main ingredients of an XML Schema are elements, types and attributes.

Elements : are declared with the <xsd:element> tag. They can have element-only, mixed, or empty of elements content. Elements can also be restricted to have certain values, i.e. types like:

  • xs:string
  • xs:decimal
  • xs:integer
  • xs:boolean
  • xs:date
  • xs:time
  • etc.

Simple types can be combined into more complex types. A complex type can define elements, attributes or data types.

Complex elements are firstly used to define element order, e.g. :

  • a sequence (appear in order)
  • a choice (any element from a list)
  • combined (can occur in any order)

Attributes are also defined within complex elements: any of the simple types can be used as attribute. The attribute can be optional, required or prohibited.

Read more in XML Schema tutorial - Basics

Tools

Editors

DTD to XSD Conversion tools

XML editors
  • Exchanger XML Editor (free) can translate from XSD to DTD.
  • ... there are other editors who can do conversion
Online
  • Online XML Utilities from HitSoftware let's you convert a DTD (and the other way round) online (free of charge). Currently, registration is required and I didn't test this service anymore - Daniel K. Schneider 16:49, 4 December 2010 (CET).
Free tools that need some installation skills
  • dtd2x Free Java class. End users can lauch the class through an HTML page (tested on win XP).
  • Trang (written by James Clark). Multi-format schema converter based on RELAX NG. Multiplatform Java-based. (Tested, works).

In education

Certain educational modeling languages use XML Schema, e.g.

Links

W3C XML Schema 1.0 Specification

W3C XML Schema 1.1 Specification

Various