Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
XML Schema (W3C)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Types== 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 type]]s (<code>anyURI</code>, <code>base64Binary</code>, <code>boolean</code>, <code>date</code>, <code>dateTime</code>, <code>decimal</code>, <code>double</code>, <code>duration</code>, <code>float</code>, <code>hexBinary</code>, <code>gDay</code>, <code>gMonth</code>, <code>gMonthDay</code>, <code>gYear</code>, <code>gYearMonth</code>, <code>NOTATION</code>, <code>QName</code>, <code>string</code>, and <code>time</code>). 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. 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 * 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.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)