HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
In a DTD, attributes ATTLIST statement to be declared.
Property declaration uses the following syntax:
These are theattributes types of options:
类型 | 描述 |
---|---|
CDATA | 值为字符数据 (character data) |
(en1|en2|/en) | 此值是枚举列表中的一个值 |
ID | 值为唯一的 id |
IDREF | 值为另外一个元素的 id |
IDREFS | 值为其他 id 的列表 |
NMTOKEN | 值为合法的 XML 名称 |
NMTOKENS | 值为合法的 XML 名称的列表 |
ENTITY | 值是一个实体 |
ENTITIES | 值是一个实体列表 |
NOTATION | 此值是符号的名称 |
xml: | 值是一个预定义的 XML 值 |
Defaultproperty values can use the following values:
值 | 解释 |
---|---|
值 | 属性的默认值 |
#REQUIRED | 属性值是必需的 |
#IMPLIED | 属性不是必需的 |
#FIXED value | 属性值是固定的 |
In the above example, "square" is defined as the "width" empty element with CDATA type of property. If the width is not set, it defaults to 0.
If you do not have a default value of the option, but still want to force authors to submit property, please use keyword #REQUIRED.
If you do not want to force the author of a property, and you do not have a default value of an option, then use the keyword #IMPLIED.
If you want to have a fixed value of the property, and allowing the author to change this value, use #FIXED keywords. If the author uses a different value, XML parser will return an error.
If you want the attribute value is one of a fixed set of legal values, use the list attribute values.