An XML document is a relatively simple item that is made up of few building blocks. This format has been recommended as a web standard in order for an XML document to be Valid. Below are the components of an XML document.
• Prolog (optional)
Document Type Declarations (DTD)
• Root Element
Attributes and Values
Prolog – The prolog is optional and contains the XML declaration and the DTD.
XML Declaration – states the version of XML that is being used.
DTD – Determines the rules that the XML document must follow. A more detailed lesson on DTDs will be visited later in this tutorial.
Root Element – Is the first element in the XML document and states the kind of XML document that it is. There can only be one root element.
Elements and – These represent the different types of data being stored in the XML document.
Attributes – Like HTML attributes, XML attributes have a name-value relationship.
Data – This is the content of the XML file and it appears between the open and closing tags of the elements.