DTD – Entities

To define shortcuts to special characters, the entities are used which can be declared either internal or external. There are three parts of an entity: An ampersand (&) An entity name A semicolon (;) An Internal Entity Declaration: Syntax: Example: DTD Example: XML example: &writer;&copyright; An External Entity Declaration: Syntax: Example: DTD Example: XML example: … Read more

Categories DTD

XML Elements vs. Attributes

For the attributes and the child elements in XML, there are no rules about when to use which one. Use of Elements vs Attributes: We can store the data either in child elements or in attributes. Example 1: Tom Gates Example 2: male Tom Gates Explanation: In the above examples, gender is an attribute in … Read more

Categories DTD

DTD – Attributes

An ATTLIST declaration is used to declare the attributes in a DTD. Declaring Attributes: Syntax: Attribute declaration: Example: DTD: Example: XML: Attribute-type: We can choose any of the below for the attribute-type: Type Uses CDATA To specify that the value is character data. (en1|en2|..) To specify that the value must be one from an enumerated … Read more

Categories DTD

DTD – Elements

An ELEMENT declaration is used to declare the elements in a DTD. Declaring Elements: Syntax: OR Empty Elements: The category keyword EMPTY is used to declare the Empty elements. Syntax: Example: XML example: Elements with Parsed Character Data: To declare the elements with only parsed character data, the #PCDATA is used inside parentheses. Syntax: Example: … Read more

Categories DTD

DTD – XML Building Blocks

The elements are the main building blocks of both XML and HTML documents. The Building Blocks of XML Documents: The XML documents, when viewed from a DTD point of view, are made up by the below-listed building blocks: Elements Attributes Entities PCDATA CDATA Elements: The main building blocks of both XML and HTML documents are … Read more

Categories DTD