Non-registered mode. Register to save your course progress.
By exploring the course, you are agreeing to our Terms of Service and Privacy Policy. Please read them carefully.
<div class="xblock xblock-student_view xblock-student_view-vertical" data-runtime-class="LmsRuntime" data-init="VerticalStudentView" data-course-id="DB/XPath/SelfPaced" data-request-token="f9b99ab647ec11e8821506b24df1fed6" data-runtime-version="1" data-usage-id="i4x:;_;_DB;_XPath;_vertical;_vert-exercise-xml_countries_xpath_xquery_core" data-block-type="vertical">
<h3 class="unit-title">XML World-Countries XPath and XQuery Exercises</h3>
<div class="bookmark-button-wrapper">
<button class="btn btn-link bookmark-button "
aria-pressed="false"
data-bookmark-id="anon__CRDfImYzmBf4NKXyd3Ebk5cZ,i4x://DB/XPath/vertical/vert-exercise-xml_countries_xpath_xquery_core">
<span class="sr bookmark-sr">Click to add</span>
<span class="bookmark-text">Bookmark this page</span>
</button>
</div>
<div class="vert-mod">
<div class="vert vert-0" data-id="i4x://DB/XPath/html/preamble-exercise-xml_countries_xpath_xquery_core">
<div class="xblock xblock-student_view xblock-student_view-html xmodule_display xmodule_HtmlModule" data-runtime-class="LmsRuntime" data-init="XBlockToXModuleShim" data-block-type="html" data-request-token="f9b99ab647ec11e8821506b24df1fed6" data-runtime-version="1" data-usage-id="i4x:;_;_DB;_XPath;_html;_preamble-exercise-xml_countries_xpath_xquery_core" data-type="HTMLModule" data-course-id="DB/XPath/SelfPaced">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "HTMLModule"}
</script>
<p><i>These exercises are a bit more difficult overall than the Course-Catalog XPath and XQuery Exercises. We suggest you work those problems first.</i> <br /> <br /> In these exercises, you will be working with a small XML data set about world countries. This data is adapted from the Mondial 3.0 database as hosted by the <a href="http://www.cs.washington.edu/research/xmldatasets/www/repository.html#mondial">University of Washington</a>, and was originally compiled by the <a href="http://www.dbis.informatik.uni-goettingen.de/Mondial/">Georg-August University of Goettingen Institute for Informatics</a>. Each country has a name, population, and area (in sq. km). Some countries also list languages (with percentages of the population that speaks each language) and/or cities (with names and populations). The XML data is <a href="https://prod-c2g.s3.amazonaws.com/db/Winter2013/files/countries.xml" target="_blank">here</a>. <br /> <br /> <b>Instructions:</b> Each problem asks you to write a query in XPath or XQuery. When you click "Check Answer" our back-end runs your query against the sample database using Saxon. It displays the result and compares your answer against the correct one. When you're satisfied with your solution for a given problem, click the "Submit" button to check your answer. <br /> <br /> You may perform these exercises as many times as you like, so we strongly encourage you to keep working with them until you complete the exercises with full credit.</p>
</div>
</div>
<div class="vert vert-1" data-id="i4x://DB/XPath/problem/exercise-xml_countries_xpath_xquery_core1">
<div class="xblock xblock-student_view xblock-student_view-problem xmodule_display xmodule_CapaModule" data-runtime-class="LmsRuntime" data-init="XBlockToXModuleShim" data-block-type="problem" data-request-token="f9b99ab647ec11e8821506b24df1fed6" data-runtime-version="1" data-usage-id="i4x:;_;_DB;_XPath;_problem;_exercise-xml_countries_xpath_xquery_core1" data-type="Problem" data-course-id="DB/XPath/SelfPaced">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core1" class="problems-wrapper" role="group"
aria-labelledby="i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core1-problem-title"
data-problem-id="i4x://DB/XPath/problem/exercise-xml_countries_xpath_xquery_core1" data-url="/courses/DB/XPath/SelfPaced/xblock/i4x:;_;_DB;_XPath;_problem;_exercise-xml_countries_xpath_xquery_core1/handler/xmodule_handler"
data-problem-score="0.0"
data-problem-total-possible="1.0"
data-attempts-used="0"
data-content="
<h3 class="hd hd-2 problem-header" id="i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core1-problem-title" aria-describedby="i4x://DB/XPath/problem/exercise-xml_countries_xpath_xquery_core1-problem-progress" tabindex="-1">
Q1
</h3>
<div class="problem-progress" id="i4x://DB/XPath/problem/exercise-xml_countries_xpath_xquery_core1-problem-progress"></div>
<div class="problem">
<div>
<span>
Return the area of Mongolia.
<br/>
<br/>
<b>Note:</b> Your solution will need to reference <b><i>doc("countries.xml")</i></b> to access the data.
<br/>
<b>Reminder:</b> To return the value of an attribute <i>attr</i>, you must use <i>data(@attr)</i>, although just <i>@attr</i> may be used in comparisons. You will need to remember this for some later questions as well.
<br/>
</span>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 1" role="group"><div id="textbox_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core1_2_1" class="capa_inputtype textbox cminput">
<label class="sr problem-group-label" for="cm-textarea-i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core1_2_1">Code Editor</label>
<textarea rows="10" cols="80" name="input_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core1_2_1" aria-label="sql editor" aria-describedby="answer_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core1_2_1" id="input_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core1_2_1" tabindex="0" data-mode="sql" data-tabsize="4" data-linenums="true">Enter your XPath or XQuery here</textarea>
<span class="cm-editor-exit-message capa-message" id="cm-editor-exit-message-i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core1_2_1">
Press ESC then TAB or click outside of the code editor to exit
</span>
<div class="grader-status" tabindex="-1">
<span class="status unanswered" id="status_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core1_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
<p class="debug">unanswered</p>
</div>
<span id="answer_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core1_2_1"/>
<div class="external-grader-message">
</div>
</div></div>
</div>
<div class="action">
<input type="hidden" name="problem_id" value="Q1" />
<div class="problem-action-buttons-wrapper">
</div>
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core1" >
<span class="submit-label" aria-hidden="true">Submit</span><span class="sr">Submit your answer</span>
</button>
<div class="submission-feedback" id="submission_feedback_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core1">
</div>
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core1-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core1-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="True">
<p class="loading-spinner">
<i class="fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
<div class="vert vert-2" data-id="i4x://DB/XPath/problem/exercise-xml_countries_xpath_xquery_core2">
<div class="xblock xblock-student_view xblock-student_view-problem xmodule_display xmodule_CapaModule" data-runtime-class="LmsRuntime" data-init="XBlockToXModuleShim" data-block-type="problem" data-request-token="f9b99ab647ec11e8821506b24df1fed6" data-runtime-version="1" data-usage-id="i4x:;_;_DB;_XPath;_problem;_exercise-xml_countries_xpath_xquery_core2" data-type="Problem" data-course-id="DB/XPath/SelfPaced">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core2" class="problems-wrapper" role="group"
aria-labelledby="i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core2-problem-title"
data-problem-id="i4x://DB/XPath/problem/exercise-xml_countries_xpath_xquery_core2" data-url="/courses/DB/XPath/SelfPaced/xblock/i4x:;_;_DB;_XPath;_problem;_exercise-xml_countries_xpath_xquery_core2/handler/xmodule_handler"
data-problem-score="0.0"
data-problem-total-possible="1.0"
data-attempts-used="0"
data-content="
<h3 class="hd hd-2 problem-header" id="i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core2-problem-title" aria-describedby="i4x://DB/XPath/problem/exercise-xml_countries_xpath_xquery_core2-problem-progress" tabindex="-1">
Q2
</h3>
<div class="problem-progress" id="i4x://DB/XPath/problem/exercise-xml_countries_xpath_xquery_core2-problem-progress"></div>
<div class="problem">
<div>
<span>
Return the names of all cities that have the same name as the country in which they are located.
<br/>
<br/>
<b>Note:</b> Your solution will need to reference <b><i>doc("countries.xml")</i></b> to access the data.
<br/>
</span>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 1" role="group"><div id="textbox_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core2_2_1" class="capa_inputtype textbox cminput">
<label class="sr problem-group-label" for="cm-textarea-i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core2_2_1">Code Editor</label>
<textarea rows="10" cols="80" name="input_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core2_2_1" aria-label="sql editor" aria-describedby="answer_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core2_2_1" id="input_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core2_2_1" tabindex="0" data-mode="sql" data-tabsize="4" data-linenums="true">Enter your XPath or XQuery here</textarea>
<span class="cm-editor-exit-message capa-message" id="cm-editor-exit-message-i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core2_2_1">
Press ESC then TAB or click outside of the code editor to exit
</span>
<div class="grader-status" tabindex="-1">
<span class="status unanswered" id="status_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core2_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
<p class="debug">unanswered</p>
</div>
<span id="answer_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core2_2_1"/>
<div class="external-grader-message">
</div>
</div></div>
</div>
<div class="action">
<input type="hidden" name="problem_id" value="Q2" />
<div class="problem-action-buttons-wrapper">
</div>
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core2" >
<span class="submit-label" aria-hidden="true">Submit</span><span class="sr">Submit your answer</span>
</button>
<div class="submission-feedback" id="submission_feedback_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core2">
</div>
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core2-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core2-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="True">
<p class="loading-spinner">
<i class="fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
<div class="vert vert-3" data-id="i4x://DB/XPath/problem/exercise-xml_countries_xpath_xquery_core3">
<div class="xblock xblock-student_view xblock-student_view-problem xmodule_display xmodule_CapaModule" data-runtime-class="LmsRuntime" data-init="XBlockToXModuleShim" data-block-type="problem" data-request-token="f9b99ab647ec11e8821506b24df1fed6" data-runtime-version="1" data-usage-id="i4x:;_;_DB;_XPath;_problem;_exercise-xml_countries_xpath_xquery_core3" data-type="Problem" data-course-id="DB/XPath/SelfPaced">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core3" class="problems-wrapper" role="group"
aria-labelledby="i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core3-problem-title"
data-problem-id="i4x://DB/XPath/problem/exercise-xml_countries_xpath_xquery_core3" data-url="/courses/DB/XPath/SelfPaced/xblock/i4x:;_;_DB;_XPath;_problem;_exercise-xml_countries_xpath_xquery_core3/handler/xmodule_handler"
data-problem-score="0.0"
data-problem-total-possible="1.0"
data-attempts-used="0"
data-content="
<h3 class="hd hd-2 problem-header" id="i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core3-problem-title" aria-describedby="i4x://DB/XPath/problem/exercise-xml_countries_xpath_xquery_core3-problem-progress" tabindex="-1">
Q3
</h3>
<div class="problem-progress" id="i4x://DB/XPath/problem/exercise-xml_countries_xpath_xquery_core3-problem-progress"></div>
<div class="problem">
<div>
<span>
Return the average population of Russian-speaking countries.
<br/>
<br/>
<b>Note:</b> Your solution will need to reference <b><i>doc("countries.xml")</i></b> to access the data.
<br/>
</span>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 1" role="group"><div id="textbox_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core3_2_1" class="capa_inputtype textbox cminput">
<label class="sr problem-group-label" for="cm-textarea-i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core3_2_1">Code Editor</label>
<textarea rows="10" cols="80" name="input_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core3_2_1" aria-label="sql editor" aria-describedby="answer_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core3_2_1" id="input_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core3_2_1" tabindex="0" data-mode="sql" data-tabsize="4" data-linenums="true">Enter your XPath or XQuery here</textarea>
<span class="cm-editor-exit-message capa-message" id="cm-editor-exit-message-i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core3_2_1">
Press ESC then TAB or click outside of the code editor to exit
</span>
<div class="grader-status" tabindex="-1">
<span class="status unanswered" id="status_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core3_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
<p class="debug">unanswered</p>
</div>
<span id="answer_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core3_2_1"/>
<div class="external-grader-message">
</div>
</div></div>
</div>
<div class="action">
<input type="hidden" name="problem_id" value="Q3" />
<div class="problem-action-buttons-wrapper">
</div>
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core3" >
<span class="submit-label" aria-hidden="true">Submit</span><span class="sr">Submit your answer</span>
</button>
<div class="submission-feedback" id="submission_feedback_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core3">
</div>
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core3-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core3-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="True">
<p class="loading-spinner">
<i class="fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
<div class="vert vert-4" data-id="i4x://DB/XPath/problem/exercise-xml_countries_xpath_xquery_core4">
<div class="xblock xblock-student_view xblock-student_view-problem xmodule_display xmodule_CapaModule" data-runtime-class="LmsRuntime" data-init="XBlockToXModuleShim" data-block-type="problem" data-request-token="f9b99ab647ec11e8821506b24df1fed6" data-runtime-version="1" data-usage-id="i4x:;_;_DB;_XPath;_problem;_exercise-xml_countries_xpath_xquery_core4" data-type="Problem" data-course-id="DB/XPath/SelfPaced">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core4" class="problems-wrapper" role="group"
aria-labelledby="i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core4-problem-title"
data-problem-id="i4x://DB/XPath/problem/exercise-xml_countries_xpath_xquery_core4" data-url="/courses/DB/XPath/SelfPaced/xblock/i4x:;_;_DB;_XPath;_problem;_exercise-xml_countries_xpath_xquery_core4/handler/xmodule_handler"
data-problem-score="0.0"
data-problem-total-possible="1.0"
data-attempts-used="0"
data-content="
<h3 class="hd hd-2 problem-header" id="i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core4-problem-title" aria-describedby="i4x://DB/XPath/problem/exercise-xml_countries_xpath_xquery_core4-problem-progress" tabindex="-1">
Q4
</h3>
<div class="problem-progress" id="i4x://DB/XPath/problem/exercise-xml_countries_xpath_xquery_core4-problem-progress"></div>
<div class="problem">
<div>
<span>
Return the names of all countries that have at least three cities with population greater than 3 million.
<br/>
<br/>
<b>Note:</b> Your solution will need to reference <b><i>doc("countries.xml")</i></b> to access the data.
<br/>
</span>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 1" role="group"><div id="textbox_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core4_2_1" class="capa_inputtype textbox cminput">
<label class="sr problem-group-label" for="cm-textarea-i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core4_2_1">Code Editor</label>
<textarea rows="10" cols="80" name="input_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core4_2_1" aria-label="sql editor" aria-describedby="answer_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core4_2_1" id="input_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core4_2_1" tabindex="0" data-mode="sql" data-tabsize="4" data-linenums="true">Enter your XPath or XQuery here</textarea>
<span class="cm-editor-exit-message capa-message" id="cm-editor-exit-message-i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core4_2_1">
Press ESC then TAB or click outside of the code editor to exit
</span>
<div class="grader-status" tabindex="-1">
<span class="status unanswered" id="status_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core4_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
<p class="debug">unanswered</p>
</div>
<span id="answer_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core4_2_1"/>
<div class="external-grader-message">
</div>
</div></div>
</div>
<div class="action">
<input type="hidden" name="problem_id" value="Q4" />
<div class="problem-action-buttons-wrapper">
</div>
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core4" >
<span class="submit-label" aria-hidden="true">Submit</span><span class="sr">Submit your answer</span>
</button>
<div class="submission-feedback" id="submission_feedback_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core4">
</div>
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core4-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core4-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="True">
<p class="loading-spinner">
<i class="fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
<div class="vert vert-5" data-id="i4x://DB/XPath/problem/exercise-xml_countries_xpath_xquery_core5">
<div class="xblock xblock-student_view xblock-student_view-problem xmodule_display xmodule_CapaModule" data-runtime-class="LmsRuntime" data-init="XBlockToXModuleShim" data-block-type="problem" data-request-token="f9b99ab647ec11e8821506b24df1fed6" data-runtime-version="1" data-usage-id="i4x:;_;_DB;_XPath;_problem;_exercise-xml_countries_xpath_xquery_core5" data-type="Problem" data-course-id="DB/XPath/SelfPaced">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core5" class="problems-wrapper" role="group"
aria-labelledby="i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core5-problem-title"
data-problem-id="i4x://DB/XPath/problem/exercise-xml_countries_xpath_xquery_core5" data-url="/courses/DB/XPath/SelfPaced/xblock/i4x:;_;_DB;_XPath;_problem;_exercise-xml_countries_xpath_xquery_core5/handler/xmodule_handler"
data-problem-score="0.0"
data-problem-total-possible="1.0"
data-attempts-used="0"
data-content="
<h3 class="hd hd-2 problem-header" id="i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core5-problem-title" aria-describedby="i4x://DB/XPath/problem/exercise-xml_countries_xpath_xquery_core5-problem-progress" tabindex="-1">
Q5
</h3>
<div class="problem-progress" id="i4x://DB/XPath/problem/exercise-xml_countries_xpath_xquery_core5-problem-progress"></div>
<div class="problem">
<div>
<span>
Create a list of French-speaking and German-speaking countries. The result should take the form:
<pre>
&lt;result&gt;
&lt;French&gt;
&lt;country&gt;country-name&lt;/country&gt;
&lt;country&gt;country-name&lt;/country&gt;
...
&lt;/French&gt;
&lt;German&gt;
&lt;country&gt;country-name&lt;/country&gt;
&lt;country&gt;country-name&lt;/country&gt;
...
&lt;/German&gt;
&lt;/result&gt;
</pre>
<b>Note:</b> Your solution will need to reference <b><i>doc("countries.xml")</i></b> to access the data.
<br/>
</span>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 1" role="group"><div id="textbox_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core5_2_1" class="capa_inputtype textbox cminput">
<label class="sr problem-group-label" for="cm-textarea-i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core5_2_1">Code Editor</label>
<textarea rows="10" cols="80" name="input_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core5_2_1" aria-label="sql editor" aria-describedby="answer_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core5_2_1" id="input_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core5_2_1" tabindex="0" data-mode="sql" data-tabsize="4" data-linenums="true">Enter your XPath or XQuery here</textarea>
<span class="cm-editor-exit-message capa-message" id="cm-editor-exit-message-i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core5_2_1">
Press ESC then TAB or click outside of the code editor to exit
</span>
<div class="grader-status" tabindex="-1">
<span class="status unanswered" id="status_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core5_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
<p class="debug">unanswered</p>
</div>
<span id="answer_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core5_2_1"/>
<div class="external-grader-message">
</div>
</div></div>
</div>
<div class="action">
<input type="hidden" name="problem_id" value="Q5" />
<div class="problem-action-buttons-wrapper">
</div>
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core5" >
<span class="submit-label" aria-hidden="true">Submit</span><span class="sr">Submit your answer</span>
</button>
<div class="submission-feedback" id="submission_feedback_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core5">
</div>
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core5-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core5-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="True">
<p class="loading-spinner">
<i class="fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
<div class="vert vert-6" data-id="i4x://DB/XPath/problem/exercise-xml_countries_xpath_xquery_core6">
<div class="xblock xblock-student_view xblock-student_view-problem xmodule_display xmodule_CapaModule" data-runtime-class="LmsRuntime" data-init="XBlockToXModuleShim" data-block-type="problem" data-request-token="f9b99ab647ec11e8821506b24df1fed6" data-runtime-version="1" data-usage-id="i4x:;_;_DB;_XPath;_problem;_exercise-xml_countries_xpath_xquery_core6" data-type="Problem" data-course-id="DB/XPath/SelfPaced">
<script type="json/xblock-args" class="xblock-json-init-args">
{"xmodule-type": "Problem"}
</script>
<div id="problem_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core6" class="problems-wrapper" role="group"
aria-labelledby="i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core6-problem-title"
data-problem-id="i4x://DB/XPath/problem/exercise-xml_countries_xpath_xquery_core6" data-url="/courses/DB/XPath/SelfPaced/xblock/i4x:;_;_DB;_XPath;_problem;_exercise-xml_countries_xpath_xquery_core6/handler/xmodule_handler"
data-problem-score="0.0"
data-problem-total-possible="1.0"
data-attempts-used="0"
data-content="
<h3 class="hd hd-2 problem-header" id="i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core6-problem-title" aria-describedby="i4x://DB/XPath/problem/exercise-xml_countries_xpath_xquery_core6-problem-progress" tabindex="-1">
Q6
</h3>
<div class="problem-progress" id="i4x://DB/XPath/problem/exercise-xml_countries_xpath_xquery_core6-problem-progress"></div>
<div class="problem">
<div>
<span>
Return the countries with the highest and lowest population densities. Note that because the "/" operator has its own meaning in XPath and XQuery, the division operator is infix "div". To compute population density use "(@population div @area)". You can assume density values are unique. The result should take the form:
<pre>
&lt;result&gt;
&lt;highest density="value"&gt;country-name&lt;/highest&gt;
&lt;lowest density="value"&gt;country-name&lt;/lowest&gt;
&lt;/result&gt;
</pre>
<b>Note:</b> Your solution will need to reference <b><i>doc("countries.xml")</i></b> to access the data.
<br/>
<i>(This problem is quite challenging; congratulations if you get it right.)</i>
<br/>
</span>
<div class="wrapper-problem-response" tabindex="-1" aria-label="Question 1" role="group"><div id="textbox_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core6_2_1" class="capa_inputtype textbox cminput">
<label class="sr problem-group-label" for="cm-textarea-i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core6_2_1">Code Editor</label>
<textarea rows="10" cols="80" name="input_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core6_2_1" aria-label="sql editor" aria-describedby="answer_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core6_2_1" id="input_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core6_2_1" tabindex="0" data-mode="sql" data-tabsize="4" data-linenums="true">Enter your XPath or XQuery here</textarea>
<span class="cm-editor-exit-message capa-message" id="cm-editor-exit-message-i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core6_2_1">
Press ESC then TAB or click outside of the code editor to exit
</span>
<div class="grader-status" tabindex="-1">
<span class="status unanswered" id="status_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core6_2_1" data-tooltip="Not yet answered.">
<span class="sr">unanswered</span><span class="status-icon" aria-hidden="true"/>
</span>
<p class="debug">unanswered</p>
</div>
<span id="answer_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core6_2_1"/>
<div class="external-grader-message">
</div>
</div></div>
</div>
<div class="action">
<input type="hidden" name="problem_id" value="Q6" />
<div class="problem-action-buttons-wrapper">
</div>
<div class="submit-attempt-container">
<button type="button" class="submit btn-brand" data-submitting="Submitting" data-value="Submit" data-should-enable-submit-button="True" aria-describedby="submission_feedback_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core6" >
<span class="submit-label" aria-hidden="true">Submit</span><span class="sr">Submit your answer</span>
</button>
<div class="submission-feedback" id="submission_feedback_i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core6">
</div>
</div>
</div>
<div class="notification warning notification-gentle-alert
is-hidden"
tabindex="-1">
<span class="icon fa fa-exclamation-circle" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core6-problem-title">
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
<div class="notification warning notification-save
is-hidden"
tabindex="-1">
<span class="icon fa fa-save" aria-hidden="true"></span>
<span class="notification-message" aria-describedby="i4x-DB-XPath-problem-exercise-xml_countries_xpath_xquery_core6-problem-title">None
</span>
<div class="notification-btn-wrapper">
<button type="button" class="btn btn-default btn-small notification-btn review-btn sr">Review</button>
</div>
</div>
</div>
"
data-graded="True">
<p class="loading-spinner">
<i class="fa-spinner fa-pulse fa-2x fa-fw"></i>
<span class="sr">Loading…</span>
</p>
</div>
</div>
</div>
</div>
</div>
By exploring the course, you are agreeing to our Terms of Service and Privacy Policy. Please read them carefully.
© All Rights Reserved