Web Technologies - Old Questions
10. What is the syntax of declaring an attributes in a DTD?
5 marks
|
Asked in 2068-II
DTD defines the legal building blocks of an XML document. It is used to define document structure with a list of legal elements and attributes.
An attribute declaration in DTD has the following syntax:
<!ATTLIST element-name attribute-name attribute-type attribute-value>
- element-name specifies the name of the element to which the attribute applies.
- attribute-name specifies the name of the attribute which is included with the element-name.
The attribute-type can be one of the following:
The attribute-value can be one of the following:
E.g.
DTD example:
<!ATTLIST employee id CDATA #REQUIRED>
XML example:
<employee id="001" />