DTD Cheet Sheet
DTD Cheet Sheet
XML A flexible text format used to store and DTD Defines the structure and rules for an XML
(eXtensible transport data, designed to be both (Document document.
Markup human-readable and machine-readable Type It ensures that the XML follows a specific schema.
Language) Definition)
Key features Platform-independent Key features Elements
Designed for information exchange Attributes
Hierarchical structure with custom tags Entities
Every XML document has one root element that holds the entire XML parser. Tags inside are treated as markup and entities will be
structure. expanded.
CDATA: (Unparsed) Character data is text which is not parsed
LEMENT candy_
<!E store (categ _ch
ory ocolate,
further in an XML document.
ry_
catego gum
my?
)>
Tags inside are not treated as markup and entities will not be
expanded.
Entities
<!E
NTITY copy "Cop
yright SweetWorld 2023"> #IMPLIED optional
Called in the XML document with ©. #FIXED fixed value
Types: CDATA (any character string)
Parameter Entities
Enumerations (predefined values)
Reusable definitions within a DTD.
Example:
Allows complex content to be reused in multiple elements. <!A
TTLIST candy chocolate_flavor CDATA #REQUIRED
NTITY % product "(price, manufa
<!E ctu
rer?, images?, sugar_content CDATA #REQUIRED>
ption?, nutrit
descri ional_
info?)">
Element Occurrence
LEMENT nutrit
<!E ional_info (calor
ies?, fat_content?,
sugar_con
tent?)>