如何将其转换为dtd属性?

时间:2014-03-25 18:57:09

标签: xml dtd xml-dtd

<review rating="5"reviewer="Peterson Johnston">

代码应该是这样的吗?

<!ATTLIST review then i don't really know how the syntax goes.

1 个答案:

答案 0 :(得分:0)

可能是这样的:

<!ATTLIST review rating   NMTOKEN #REQUIRED>
<!ATTLIST review reviewer CDATA   #REQUIRED>

<!ATTLIST review rating   NMTOKEN #REQUIRED>
                 reviewer CDATA   #REQUIRED>

语法(对于一个属性)是:

<!ATTLIST element-name attribute-name attribute-type attribute-usage>

数字通常是NTOKEN(不允许空格或特殊字符)和字符串CDATA。您还可以枚举NMTOKENS (option1 | option2)。属性类型也可以是#IMPLIED(可选),#FIXED "value",默认值"value"