diff --git a/Klausuren/Sda1/2015summer/Exam_solve/Doc/scriptXsd.xhtml b/Klausuren/Sda1/2015summer/Exam_solve/Doc/scriptXsd.xhtml index c98eca621ff411915c0a01e8e6f491e97e51bb67..cfd7e6563752e151c74c18e622e82f1e024ab2b5 100644 --- a/Klausuren/Sda1/2015summer/Exam_solve/Doc/scriptXsd.xhtml +++ b/Klausuren/Sda1/2015summer/Exam_solve/Doc/scriptXsd.xhtml @@ -1,54 +1,112 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> -<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"> +<html xmlns="http://www.w3.org/1999/xhtml"> <head> - <title></title> + <title>XSD Schema</title> </head> - <body><h1>Description</h1><p>This exercise deals with executable scripts - from different programming languages. You are expected to supply an <a + <body><!--?xml version="1.0" encoding="UTF-8"?--> <h1>Description</h1> + <p>This exercise deals with executable scripts from different programming + languages. You are expected to supply an <a href="http://www.w3schools.com/schema/default.asp">XSD</a> schema file which basically allows for defining:</p><ul> <li>A set of available programming languages</li> <li>A collection of code fragments (scripts) being related to one or more programming languages.</li> - </ul><h1>Preparations</h1><p>Download <a - href="/files/goik/Sda1/HHg22f+7++QQ-Gcctz3gh/scripts.zip" - target="_blank">scripts.zip</a> and import it as an Eclipse Maven project - into your workspace. This project contains a sample data file - <code>Schema/sampledata.xml</code>.</p><h1>Task</h1><p>Complete the provided - schema <code>Schema/scripts.xsd</code> file which is yet essentially empty. - The following constraints shall hold: </p><ul> - <li>Each programming language name below the global - <code><languages></code> section must be unique.</li> + </ul><h1 id="preparations">Preparations</h1><p>Download <a + href="../files/goik/Sda1/HHg22f+7++QQ-Gcctz3gh/exam.zip" + target="_blank">exam.zip</a> and unzip it. Then import the resulting + <code>Exam</code> directory as a <strong>Maven Eclipse</strong> project into + your workspace. Subsequently mentioned relative file and directory path + names refer to this project's root.</p><h1>Task</h1><p>Start from + <code>Schema/scripts.xsd</code>. Extend this file thereby providing an XML + schema grammar implementing the constraints being described in the <a + href="#dataModel">Data model description</a> section + below.</p><h1>Hints</h1><ul> + <li>The sample data file <code>Schema/sampledata.xml</code> illustrates + the constraints being described in the <a href="#dataModel">Data model + description</a> section below.</li> + + <li><p>The sub directory <code>SchemaTest</code> contains unit tests + checking your schema for correctness. Some files contained within must + be valid and some must be invalid with respect to your + <code>Schema/scripts.xsd</code> implementation.</p><p>You may execute + <code>de.hdm_stuttgart.mi.sda1.scripts.SchemaTest</code> from your + project's <code>src/test/java</code> branch as a Junit test. If your + schema is correct you'll read:</p><pre>++Instance SchemaTest/invalidHasReference.xml: Gaining 1 point. +++Instance SchemaTest/invalidUniqueMultipleLanguageRef_err.xml: Gaining 1 point. +++Instance SchemaTest/invalidMultipleReference.xml: Gaining 1 point. +++Instance SchemaTest/invalidUniqueId.xml: Gaining 1 point. +++Instance SchemaTest/invalidUniqueLanguage.xml: Gaining 2 points. +++Instance SchemaTest/validFull.xml: Gaining 1 point. +++Instance SchemaTest/invalidSingleReference.xml: Gaining 1 point. +++Instance SchemaTest/invalidIdNoSpace.xml: Gaining 1 point. +<strong>9 of 9 points have been reached</strong></pre></li> + </ul><h1 id="dataModel">Data model description</h1><p>We consider + <code>Schema/sampledata.xml</code> illustrating script + descriptions:</p><pre><top xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="scripts.xsd"> + + <languages> + <language>bourneshell</language> + <language>python</language> + <language>ruby</language> + <language>php</language> + <language>html</language> + </languages> + + <scripts> + <script id="recursiveTextFileSearch"> + <description>Recursively search for files having a .txt extension</description> + <language>bourneshell</language> + <sourcecode>find . -type f -and -name \*.txt</sourcecode> + </script> + <script id="phpBasicHelloWorld"> + <description>Basic 'hello, world...' snippet</description> + <languages> + <language>html</language> + <language>php</language> + </languages> + <sourcecode>&lt;html&gt; + &lt;head&gt; + &lt;title&gt;PHP Test&lt;/title&gt; + &lt;/head&gt; + &lt;body&gt; + &lt;?php echo '&lt;p&gt;Hello World&lt;/p&gt;'; ?&gt; + &lt;/body&gt; + &lt;/html&gt;</sourcecode> + </script> + </scripts> +</top></pre><p>The following constraints shall hold:</p><ul> + <li>Each programming language name in the global + <code>/top/languages</code> section must be unique.</li> <li>Each <code><script ... ></code> must have a unique <code>id</code> attribute value not containing any space characters.</li> - <li>Each <code><script ... ></code> must have to at least one - reference or a list of references to a programming language. A list of - references must not contain duplicates.</li> - </ul><h1>Hints</h1><ul> - <li>XPath expressions appearing in XML schema selector elements are - being restricted to a subset of the full XPath specification. - Expressions containing double slashes ...//... may be rewritten to an - equivalent expression.</li> - - <li>The supplied <code>Schema/sampledata.xml</code> may guide you. - However do not forget to implement all previously mentioned - constraints.</li> - </ul><h1 style="color: red;">Caution!</h1><ul> - <li>Upon completion zip up your Maven project directory and upload it to - the E-learning system.</li> + <li>Each <code><script ... ></code> must have either of a + <code><language></code> reference or a list of references below + <code><languages></code> to a programming language being defined + below the global <code>/top/languages</code> section.</li> - <li>You may re-upload your project after further processing this or - subsequent exercises , see provided hints.</li> + <li>For each <code><script></code> a list of language references + below <code>script/languages</code> must not contain duplicates.</li> + </ul><h1>Hints</h1><p>XPath expressions appearing in XML schema selector + elements are being restricted to a subset of the full XPath specification. + Expressions i.e. containing double slashes ...//... must thus be rewritten + to an equivalent expression.</p><h1 style="color: red;">Uploading, + caution!</h1><ul> + <li><p>Upon completion zip up your Maven project and use the upload + facility below.</p></li> - <li>Only your last upload will become subject for marking.</li> + <li>You may re-upload your project after further processing this or + subsequent exercises. <strong style="color: red;">In case of multiple + uploads only your last uploaded zip archive will become subject to + marking.</strong>.</li> - <li>Mind the remaining time! <b style="color:red;">When the examination - terminates no subsequent uploads will be possible!</b></li> + <li><p>Mind the remaining time! <strong style="color: red;">When the + examination terminates no subsequent uploads will be + possible!</strong></p></li> </ul></body> </html>