XML – Prolog
XML Prolog is the component added in the beginning of an XML document. Otherwise, we can say that whatever it appears before the document’s root element can be considered as Prolog. XML Prolog includes XML declaration, DOCTYPE and comments, processing instructions too.
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <?xml-stylesheet type="text/css" href="/style/design"?> <!-- This is a comment --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <customer_list> <customer> <name> Sanjay</name> <location> Mumbai</location> </customer> <customer> <name> Micheal</name> <location> Washington</location> </customer> </customer_list>
DOCTYPE is used to mention the Document type Definition and it is used for validation purpose.We could call it as a valid XML if it get validated through DTD. DTD will consists the structure of an XML document. DTD defines the elements to be used in the XML document.
<!DOCTYPE customer_list [ <!ELEMENT customer_list (customer)> <!ELEMENT customer (name,location)> <!ELEMENT name (#PCDATA)> <!ELEMENT location (#PCDATA)> ]>