HTML and CSS Reference
In-Depth Information
Table 12-5 XML Simple Type and Complex Type Elements
Description and XML Element
XML Schema
an XML element that contains only text
<xs:element name="irst_name" type="string" />
an XML element that contains child elements or attributes
<xs:element name="products">
<xs:element name="item" type="childType"
minOccurs="1" maxOccurs="unbounded" />
The definition of elements in the schema must include the data type. XML Schema
Definition has several built-in data types shown in Table 12-6. From this list of simple
data types, a developer can build custom data types. Custom data types begin with a base
data type and include restrictions in the form of domain (range of valid values), length, or
number of characters or digits (patterns).
Table 12-6 XML Schema Definition Data Types
Data Types
data is any set of characters
data is any whole number not a fraction
data is any number that contains a decimal fraction
represent the date as YYYY-MM-DD
binary logic of true or false, yes or no, on or off
a set of binary codes in groups of eight
a valid URI Internet address
Custom data types are quite common in database systems. These data types help
in validating data fields, to reduce erroneous data entry. Table 12-7 shows an example
custom data type. The example shows a custom data type field called age_range, which
has a domain between 18 and 70. A domain is a set of valid values for a database field.
Table 12-7 XML Custom Data Types
Custom Data Type Example
<xs:simpleType name="age_range">
<xs:restriction base=xs:integer">
<xs:minInclusive value="18" />
<xs:maxInclusive value="70" />
<xs:element name="employee">
<xs:element name="employment_age" type="age_range" />
</xs:element name="employee">
Search WWH ::

Custom Search