Junior
What data types exist in XSD?
sobes.tech AI
Answer from AI
In XSD, there are two main data types:
-
Primitive types: These are basic and not built upon other XSD types. They cover fundamental concepts such as strings, numbers, boolean values, and dates.
-
Derived types: These are created by extending or restricting existing types (primitive or other derived types).
Main primitive data types:
xs:string- Sequence of characters.xs:boolean- Logical value (true,false,1,0).xs:decimal- Decimal number.xs:float- Single-precision floating-point number (32 bits).xs:double- Double-precision floating-point number (64 bits).xs:integer- Whole number (without fractional part, can be negative).xs:date- Calendar date.xs:time- Time of day.xs:dateTime- Date and time.xs:duration- Duration of time.xs:anyURI- Universal resource pointer (URI).xs:QName- Qualified name.xs:base64Binary- Binary data in Base64 encoding.xs:hexBinary- Binary data in Hex encoding.xs:NOTATION- List of notations.
Many derived types are standard, for example:
xs:long- Derived fromxs:integer.xs:int- Derived fromxs:long.xs:short- Derived fromxs:int.xs:byte- Derived fromxs:short.xs:nonNegativeInteger- Derived fromxs:integer.xs:positiveInteger- Derived fromxs:nonNegativeInteger.xs:nonPositiveInteger- Derived fromxs:integer.xs:negativeInteger- Derived fromxs:nonPositiveInteger.xs:unsignedLong- Derived fromxs:nonNegativeInteger.xs:unsignedInt- Derived fromxs:unsignedLong.xs:unsignedShort- Derived fromxs:unsignedInt.xs:unsignedByte- Derived fromxs:unsignedShort.xs:normalizedString- Derived fromxs:string(removes carriage return, newline, tab characters).xs:token- Derived fromxs:normalizedString(removes leading/trailing spaces, replaces sequences of spaces with a single space).xs:language- Derived fromxs:token.xs:Name- Derived fromxs:token.xs:NCName- Derived fromxs:Name.xs:ID- Derived fromxs:NCName.xs:IDREF- Derived fromxs:NCName.xs:IDREFS- List ofxs:IDREF.xs:ENTITY- Derived fromxs:NCName.xs:ENTITIES- List ofxs:ENTITY.xs:NMTOKEN- Derived fromxs:token.xs:NMTOKENS- List ofxs:NMTOKEN.
User-defined derived types can be created using <xs:simpleType> and <xs:complexType> elements, using restriction (restriction) or extension (extension) of existing types.