DTD Validation
DTD defines the XML structure with a list of elements, attributes, and entities. DTD is widely used in document-centric applications. DTD can be stored as a file or embedded in XML documents. The DTDs included within an XML document are called “internal DTDs.” An example is shown as follows (contact_list_in.xml):
<?xml version = ‘1.0’ encoding = ‘UTF-8’?>
<!DOCTYPE contact_list[
<!ELEMENT contact_list (contact+)>
<!ELEMENT contact (first_name,last_name)>
<!ELEMENT first_name (#PCDATA)>
<!ELEMENT last_name (#PCDATA)>
<!ATTLIST contact id CDATA #REQUIRED>
<!ENTITY author “John Smith”>
<!ENTITY book “Oracle Database 11g: Building Oracle XML DB Applications”>]>
<contact_list>
<contact id=“1”>
<first_name>John</first_name>
<last_name>Smith</last_name> ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access