User defined data types in XML schema: Simple, complex, list, overload

User defined types in XML schema: User defined types can be used in XML schema with restrictions.

For Example:

<simpleType name=”EmplType”>
<restriction base=”integer”>
<minInclusive value=”150″ />
<maxExclusive value=”250″ />

The above given user defined type EmplType restricts employee numbers in a range from 150 to 249. When attributes are defined in the schema as data type EmplType, restrictions are implemented automatically. Facets which are a set of data type characteristics can be used for creating restrictions.

By using list of data items for another data type: A user defined type can also be created by using list of data items for another data type.

For Example:

<simpleType name=EmpListType”>
<list itemType=”EmpType” />

Complex data type: Complex data types can also be defined in a XML schema.

For Example:

<complexType name=”EmpType”>
<element name=”employeeNumber” type=”integer” />
<element name=”employeeName” type=”string” />
<element name=”employeeSalary” type=”Decimal” />

Overload a user defined type: A user defined data type can also be overloaded.

For Example:

<simpleType name=”EmpNewType”>
<union memberTypes=”EmplType EmpType” />

Leave a Reply