In: Computer Science
Exercise 2:
Write an XML document describing a person: name, occupation,
address and hobbies. Please do not use your own information, you
can use fake data. Decide on suitable element names and nesting.
Check your document for well-formedness.
Exercise 3:
Draw a tree that represents the XML document you created in task 2.
SOLUTION-
Exercise 2:
CODE-
<?xml version="1.0" encoding="iso-8859-1"?>
<person>
<name>
<gname>Oskari</gname>
<fname>Heinonen</fname>
</name>
<occupation>assistant</occupation>
<address>
<affil>Univ. of Helsinki, Dept. of Computer Science</affil>
<pbox>P.O. Box 68</pbox>
<street>Gustaf Hällströmin katu 2b</street>
<pcode>FI-00014</pcode>
<plocale>University of Helsinki</plocale>
</address>
<hobbies>
<hobby>eating</hobby>
<hobby>sleeping</hobby>
</hobbies>
</person>
Sample output for the xml:
Validity of XMl code:
Exercise 3 )
IF YOU HAVE ANY DOUBT PLEASE COMMENT DOWN BELOW I
WILL SOLVE IT FOR YOU:)
----------------PLEASE RATE THE ANSWER-----------THANK
YOU!!!!!!!!----------