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

Document XML: Part 1: Request To Record A TV Program

This document provides examples of XML files used to make API requests and instructs the reader to create documentation tables summarizing the structure and elements of each XML file. The first XML file is used to record a TV program and includes elements for date, time, duration, and channel. The second XML file records a TV program with attributes for date, time, duration, and channel. The third XML file contains temperature and humidity sensor data collected hourly by devices in a museum and reported daily, including elements for date, device ID, temperature, and humidity.

Uploaded by

mamunNSN
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)
36 views

Document XML: Part 1: Request To Record A TV Program

This document provides examples of XML files used to make API requests and instructs the reader to create documentation tables summarizing the structure and elements of each XML file. The first XML file is used to record a TV program and includes elements for date, time, duration, and channel. The second XML file records a TV program with attributes for date, time, duration, and channel. The third XML file contains temperature and humidity sensor data collected hourly by devices in a museum and reported daily, including elements for date, device ID, temperature, and humidity.

Uploaded by

mamunNSN
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/ 3

Document XML

In this exercise, you will create documentation for two XML files. You'll need a Markdown editor,
like you did for the documenting JSON exercise.

Part 1: Request to record a TV program


Let's say that you have an API that lets you control various electronic devices through an app.
The app could send out an API request to record a TV program with XML that looks like this:

<recordTV>
<date>2015-06-01</date>
<time format="24">18:00</time>
<duration>1.5</duration>
<channel>54</channel>
</recordTV>

Open up your word processor and create a table. Refer to the previous lecture to figure out what
should be in that table. Also, in the table, be sure to include information from these notes from
the developer:
The date element is optional. If not included, it will use today's date
The format attribute on time can be either "24" or "12" for 24 or 12 hour formats. (12 hour
formats are like "6:00 PM")

You only need to create one table. Don't forget to include a one line description before the table.
Part 2: Different TV request
Now copy and paste your table and modify it so that it works for the same data, but in a slightly
different form that uses more attributes:

<recordTV>
<when date="2015-06-01" time="18:00" format="24"/>
<duration hours="1.5"/>
<station channel="54"/>
</recordTV>

The same notes as before apply. Again, you only need to create one table. I suggest that you
only have one row each for duration and station, since they only have one attribute and are
otherwise empty. It seems unnecessary to have an extra row for their one attribute. But this is a
judgement call — the kind of judgement call you will often have to make as an API writer.
Part 3: Temperature and Humidity
Let's use an example from the "Internet of Things". That's where devices make API requests
without people being directly involved. Imagine you have a museum with a bunch of sensors
scattered about that measure temperature and humidity. They send that information to a
computer that gathers up the data and sends it to a server through an API request, once per
day. The XML that the museum computer sends looks like this:

<dailyData>
<date>2015-06-01</date>
<hourlyData>
<time>10:00</time>
<device>
<id>34</id>
<temperature>70</temperature>
<humidity>11</humidity>
</device>
<device>
<id>35</id>
<temperature>72</temperature>
<humidity>12</humidity>
</device>
...
</hourlyData>
<hourlyData>
<time>11:00</time>
<device>
<id>34</id>
<temperature>71</temperature>
<humidity>10</humidity>
</device>
...
</hourlyData>
...
</dailyData>

Notes:
time is local time.
temperature is degrees F
humidity is percentage

Create a series of documentation tables for this response. Don't worry about putting in links for
this exercise. Each of the tables should have one line before them in the format:

objectName: One sentence description.

You might also like