0% found this document useful (0 votes)
110 views

Unit 6 Programming Assignment cs2205

The document contains 4 exercises related to XML. Exercise 1 asks to write an XML document with a root element of <exercises> and child elements of <date> and <item> for the date and first two exercises. Exercise 2 asks to write an XML document describing a person with elements such as <name>, <occupation>, <address>, and <hobbies>. Exercise 3 asks to draw a tree representing the person XML document. Exercise 4 provides a partially completed XML document outlining a student's program of study and semester classes.

Uploaded by

cr rcr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
110 views

Unit 6 Programming Assignment cs2205

The document contains 4 exercises related to XML. Exercise 1 asks to write an XML document with a root element of <exercises> and child elements of <date> and <item> for the date and first two exercises. Exercise 2 asks to write an XML document describing a person with elements such as <name>, <occupation>, <address>, and <hobbies>. Exercise 3 asks to draw a tree representing the person XML document. Exercise 4 provides a partially completed XML document outlining a student's program of study and semester classes.

Uploaded by

cr rcr
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

EXERCISE 1: Write an XML document describing the exercises in this document: the root

element is <exercises>.

The root has an attribute number that has value 1. The root element has three child
elements; <date> that contains as text the date of the exercise, and two <item> elements for
the first two exercises (1--2). Write some text in the <item> elements.

<?xml version="1.0" encoding="ISO-8859-1" ?>

<exercise>

<date>07-08-2022</date>

<item1>Read About XML</item1>

<item2>Practice XML</item2>

</exercise>

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.

<?xml version="1.0" encoding="UTF-8"?>

<person>

<name>

<firstname>Rubwa</firstname>

<lastname>Wimbwa</lastname>
</name>

<occupation>Driver</occupation>

<address>

<street1>4567 Street</street1>

<street2>Tuta Stari</street2>

<suburb>Katutu</suburb>

<city>Kinshasa</city>

<province>Bukavu</province>

<postalcode>P.O box 3000</postalcode>

<country>D.R.C</country>

</address>

<hobbies>

<hobby>playing</hobby>

<hobby>watching movies</hobby>

<hobby>Coding</hobby>

</hobbies>

</person>
Exercise 3: Draw a tree that represents the XML document you created in task 2.
Person

Names Hobbies Job Title Address

LastName FirstName Hobby Hobby Organization Po.Box

Street City State ZipCode

EXERCISE 4:

<?xml version="1.0" encoding="UTF-8"?>

<!-- outlining the program of study of a student -->

<programofstudy>

<program year="2008" semester="Fall">

<class>

<course1> PHIL 101</course1>

<goal> 8 </goal>

<course2>ECON 201</course2>

<goal> 11 </goal>

</class>

<core> MGT 217 </core>


<major>

<course1> CIS 120 </course1>

<course2> CIS 403 </course2>

</major>

</program>

<program year="2009" semester="Spring">

<core1> MGT 261 </core1>

<core2> MKTG 325 </core2>

You might also like