XML DTD LEARNING SUMMARY
========================
I learn DTD defines the structure, elements, and attributes allowed in an XML document and It ensures that XML data follows a specific format and is well-formed and valid.
This is a uses DTD
• Validates XML documents.
• Provides a formal structure for data exchange.
• Defines element hierarchy, order, and attributes.
This a 2 Types of DTD
1. Internal DTD
Defined within the XML document.
xml
CopyEdit
]>
John
Mary
Hello!
2. External DTD
Stored in a separate file and linked to the XML document.
o note.xml
xml
CopyEdit
John
Mary
Hello!
o note.dtd
xml
CopyEdit
This is a Basic DTD Concepts
1. ELEMENT Declaration
Defines element names and order.
xml
CopyEdit
2. ATTLIST Declaration
Defines attributes and their types.
xml
CopyEdit
The Data Types:
o #PCDATA – Parsed character data (text).
o CDATA – Unparsed text.
o ID – Unique identifier.
o IDREF – Refers to another element’s ID.
Advantages of DTD:
• Simple and easy to learn.
• Ensures document consistency.
Limitations of DTD:
• No support for data types.
• Cannot handle namespaces.
• Less flexible than XML Schema (XSD).
•
LEARNING
I learned XML DTDis widely used to store and exchange structured data. To ensure that an XML document follows a specific format, Document Type Definition (DTD) is used. DTD defines the structure, elements, and attributes allowed in an XML document, making it easier to validate and maintain consistency across systems.