The next three lines we create will describe the child elements of root element mail.
<title>Welcome To LearningSteps.com</title>
<to>fred@leanrningsteps.com</to>
<body>Hi Fred, Welcome To Leanringsteps.com</body>
XML element may contain attributes that are associated with the element for example
<mail date="21/10/2007"></mail>
In XML the attribute value must always be quoted like above.
Comments in XML
The syntax for writing comments in XML is similar to that of HTML.
<!-- This is a comment -->
And finally the last line defines the end of the root element
</mail>
So here is our full example
<?xml version="1.0"? encoding="ISO-8859-1"?>
<mail>
<title author="fred">Welcome To LearningSteps.com</title>
<to>fred@leanrningsteps.com</to>
<body>Hi Fred, Welcome To Leanringsteps.com</body>
</mail>
Before we continue you should remember a couple of golden rules when creating xml pages
Congratulations you have created you first xml document now save it as mail.xml
Viewing xml documents
Viewing xml documents is different to viewing HTML pages what you get is color coded root and child elements, A plus (+) or minus sign (-) to the left of the elements can be clicked to expand or collapse the element structure.
Note: If your xml is formatted incorrectly the browser will throw an error telling you where the problem is.