Your First XML Exercise
1. Open NotePad.
2. Type the following text. This is your XML document. Be aware that XML is case sensitive.
<?xml
version="1.0"?>
<?xml-stylesheet type="text/css"
href="first.css"?>
<books>
<title>Word
Power Made Easy</title>
<author>Norman
Lewis</author>
<year>1949</year>
<title>Cod</title>
<author>Mark
Kurlansky</author>
<year>1997</year>
<title>The
Image of the City</title>
<author>Kevin
Lynch</author>
<year>1960</year>
</books>
3. Save the document as ¡°first.xml¡±. Make sure that you select ¡°All Files¡± at ¡°Save as type:¡± field.
4. Create another blank document at NotePad, and type the following text. (CSS)
title
{display: block; font-size: 20; color: red}
author
{display: block; font-size: 16; color: blue}
year {display:
block; font-size: 14; color: green; margin-bottom: 20px}
5. Save the document as ¡°first.css¡±. Again, make sure that you select ¡°All Files¡± at ¡°Save as type:¡± field.
6. Open ¡°first.xml¡± file with your Internet Explorer. You will see the result.
7. Good luck!
[Comments]
1.
Each xml document should start with XML declaration: <?xml version="1.0"?>
2.
You have to provide ¡°display¡± information either by CSS or XSL to show a result. In this example,
<?xml-stylesheet
type="text/css" href="first.css"?>
3.
Each xml should have the top ¡°container¡± element (tag). In this example,
<book></book>.
4.
Each element (tag) should be paired: <title></title> or
<author></author>.