ENGLISH | JAPANESE |
<< | HOW TO RELAX/Part 1: RELAX Core/STEP 3: Datatypes | >> |
none
and emptyString
.none
is an empty datatype. No character strings belong to this datatype. RELAX uses none
so as to prohibit attributes. In the following example, the class
attribute is prohibited.
<tag name="p"> <attribute name="class" type="none"/> </tag> |
Thus, the following start tag is not permitted.
<p class="foo"> |
emptyString
is a datatype that allows the empty string only. This datatype is compatible with EMPTY
of DTD.
<elementRule role="em" type="emptyString"/> |
This elementRule
allows the following two elements only. Whitespace characters may not occur between <em>
and </em>
.
<em/> |
<em></em> |
integer
and further specify a constraint "18 thru 65". The syntax for such additional constraints is the same as in XML Schema Part 2.elementRule
, attach child elements to the elementRule
.age
is a reference to integer
. minInclusive
and maxInclusive
represent constraints on minimum and maximum values, respectively. Thus, permissible contents of age
elements are character strings representing integers from 18 to 65.
<elementRule role="age" type="integer"> <minInclusive value="18"/> <maxInclusive value="65"/> </elementRule> |
A age
element can contain string "20" as its content.
<age>20</age> |
But string "11" is not allowed.
<age>11</age> |
attribute
, attach child elements to attribute
.sex
attribute of employee
is constrained to be either man
or woman
. Here, enumeration
is a constraint which specifies a permissible value.
<tag name="employee"> <attribute name="sex" type="NMTOKEN"> <enumeration value="man"/> <enumeration value="woman"/> </attribute> </tag> |
The sex
attribute can have the string "man"
.
<employee sex="man"/> |
But it cannot contain the string "foo"
.
<employee sex="foo"/> |
<< | HOW TO RELAX/Part 1: RELAX Core/STEP 3: Datatypes | >> |