Junior
What data types exist in XSD?
sobes.tech AI
Answer from AI
In XSD (XML Schema Definition), there are built-in and derived data types.
Built-in data types are divided into primitive and derived from primitive:
Primitive types:
xsd:string: a sequence of characters.xsd:boolean: a logical value (trueorfalse,1or0).xsd:decimal: a floating-point number based on decimal representation.xsd:float: a 32-bit floating-point number based on IEEE 754.xsd:double: a 64-bit floating-point number based on IEEE 754.xsd:duration: a time interval.xsd:dateTime: date and time.xsd:time: time of day.xsd:date: date.xsd:gYearMonth: month and year.xsd:gYear: year.xsd:gMonthDay: month and day.xsd:gDay: day of the month.xsd:gMonth: month.xsd:hexBinary: binary data encoded in hexadecimal format.xsd:base64Binary: binary data encoded in Base64.xsd:anyURI: universal resource identifier (URI).xsd:QName: qualified name (namespace prefix + local name).xsd:NOTATION: reference to an XML notation declaration.
Derived from primitive types:
xsd:normalizedString: a string where line breaks, carriage returns, and tabs are replaced with spaces.xsd:token: a string without leading/trailing spaces and with sequences of spaces replaced by a single space.xsd:language: language code according to RFC 3066.xsd:NMTOKEN: an XML name token.xsd:NMTOKENS: a list of XML name tokens separated by spaces.xsd:Name: an XML name.xsd:NCName: an XML name without a colon.xsd:ID: a unique identifier in an XML document.xsd:IDREF: a reference to anxsd:ID.xsd:IDREFS: a list of references to IDs.xsd:ENTITY: an unparsed XML entity.xsd:ENTITIES: a list of unparsed XML entities.xsd:integer: an integer of arbitrary precision.xsd:long: a 64-bit signed integer.xsd:int: a 32-bit signed integer.xsd:short: a 16-bit signed integer.xsd:byte: an 8-bit signed integer.xsd:nonPositiveInteger: an integer ≤ 0.xsd:negativeInteger: an integer < 0.xsd:nonNegativeInteger: an integer ≥ 0.xsd:positiveInteger: an integer > 0.xsd:unsignedLong: a 64-bit unsigned integer.xsd:unsignedInt: a 32-bit unsigned integer.xsd:unsignedShort: a 16-bit unsigned integer.xsd:unsignedByte: an 8-bit unsigned integer.
Derived data types:
Can be defined by the user through restriction, extension, list, or union of existing types.
Example of defining a custom type:
<xsd:simpleType name="age">
<xsd:restriction base="xsd:integer">
<xsd:minInclusive value="0"/>
<xsd:maxInclusive value="150"/>
</xsd:restriction>
</xsd:simpleType>