Meeskond "KM": Difference between revisions
From ICO wiki
Jump to navigationJump to search
Line 347: | Line 347: | ||
</pre> | </pre> | ||
===XML Stiilifail=== | |||
Üldine vaade test andmetele | Üldine vaade test andmetele | ||
Latest revision as of 19:55, 15 March 2014
LIIKMED
- Kristian Kalm
- Hendri Mikita
Kodutöö XML osa
Teemaks oleme valinud liiklus teooria eksami sooritamise keskonna.
XML Fail
Juurelemendiks on <node>, mille sees asuvad alam elemendid <result> , iga päringuga tuleb kaasa result element, kus on ära määratud päringu tulemus, juhul kui tulemus leitakse antakse sisu elemendis mille alamelemendid on <user> <tests> <schools> <testquestions> - viimasel kolmel on alam elemendid sama nimetusega ainsuses.
<test> - hoitakse kasutaja testi ajalugu <testquestion> - hoitakse ühe testi tulemust ja vastavaid küsimusi omakorda <question> elemendis <school> - hoitakse autokoole, kaasa antakse ka elemendis <reviews> antud ülevaated kooli kohta
XML koos näidisandmetega
<?xml version="1.0" encoding="utf-8" ?> <?xml-stylesheet type="text/xsl" href="liiklustest.xsl"?> <node> <result> <id>1</id> <success>true</success> <message>Andmed leiti</message> </result> <data> <user> <id>11</id> <name>Enn Seen</name> <email>email@email.com</email> <hash>1b855b48c60892590f99f09fa082b344</hash> <birthday>1995-02-19</birthday> <school>Autosoit OÜ</school> <reg_date>2014-02-19</reg_date> <last_seen>2014-02-19</last_seen> <facebook_id>100000921243013</facebook_id> <level>1</level> </user> <tests> <test> <id>1</id> <type>0</type> <start_date>2014-02-19 00:00:00</start_date> <end_date></end_date> <time_count>3500</time_count> <question_count>60</question_count> <correct_count>0</correct_count> </test> <test> <id>2</id> <type>0</type> <start_date>2014-02-19 00:00:00</start_date> <end_date>2014-02-19 00:01:00</end_date> <time_count>0</time_count> <question_count>60</question_count> <correct_count>45</correct_count> </test> <test> <id>3</id> <type>0</type> <start_date>2014-02-19 00:00:00</start_date> <end_date>2014-02-19 00:01:00</end_date> <time_count>1500</time_count> <question_count>50</question_count> <correct_count>49</correct_count> </test> <test> <id>4</id> <type>2</type> <start_date>2014-02-19 00:00:00</start_date> <end_date>2014-02-19 00:01:00</end_date> <time_count>200</time_count> <question_count>50</question_count> <correct_count>20</correct_count> </test> <test> <id>5</id> <type>1</type> <start_date>2014-02-19 00:00:00</start_date> <end_date>2002-02-19 00:01:00</end_date> <time_count>500</time_count> <question_count>50</question_count> <correct_count>33</correct_count> </test> </tests> <schools> <school> <id>1</id> <name>ABC Koolitus</name> <agent>Jaan Ervin ÜksJalg-Värav</agent> <address>Kohila 4</address> <mobile>564321</mobile> <number></number> <email>jeüjv@abc.ee</email> <rating>4.5</rating> <reviews> <review> <id>1</id> <user_name>Enn</user_name> <stars>5</stars> <comment>Korralik koht, Jaan oli veits ülbe</comment> </review> <review> <id>2</id> <user_name>Teet</user_name> <stars>4</stars> <comment>Soovitan</comment> </review> </reviews> </school> <school> <id>2</id> <name>Autokool Tühi Kumm</name> <agent>Peeter Eeter</agent> <address>Moskva 6</address> <mobile>3725555555</mobile> <number>56783333</number> <email>eeter@kumm.ee</email> <rating>3</rating> <reviews> <review> <id>3</id> <user_name>Teele Eeter</user_name> <stars>3</stars> <comment>Jama</comment> </review> <review> <id>4</id> <user_name>Tiit</user_name> <stars>2</stars> <comment>Väga kallis ja jube koht</comment> </review> <review> <id>5</id> <user_name>Aleksei</user_name> <stars>4</stars> <comment>Norm</comment> </review> </reviews> </school> </schools> <testquestions> <testquestion> <id>1</id> <answer>111</answer> <answer_correct>1</answer_correct> <date>2014-02-19</date> <question> <id>1</id> <name>Millised isikukahjud nimetatutest hüvitatakse liikluskindlustuse seaduse alusel?</name> <answ_one>Ajutisest või püsivast töövõimetusest tulenev kahju.</answ_one> <answ_two>Kannatanu ravikulud.</answ_two> <answ_three>Isikukahjuga seotud valu ja vaev.</answ_three> <bin_answ>111</bin_answ> <picture></picture> <category>a</category> <language>est</language> </question> </testquestion> <testquestion> <id>2</id> <answer>101</answer> <answer_correct>0</answer_correct> <date>2014-02-19</date> <question> <id>2</id> <name>Millised ohud tekivad sõites märjal munakivisillutisel?</name> <answ_one>Rattad võivad pidurdamisel kergesti blokeeruda.</answ_one> <answ_two>Kukkumisoht on suurenenud.</answ_two> <answ_three>Kiirendusel võib tagaratas libisema hakata.</answ_three> <bin_answ>111</bin_answ> <picture></picture> <category>a</category> <language>est</language> </question> </testquestion> <testquestion> <id>3</id> <answer>10</answer> <answer_correct>0</answer_correct> <date>2014-02-19</date> <question> <id>3</id> <name>Millele peate tähelepanu pöörama, kui soovite kaasa võtta kaassõitja?</name> <answ_one>Kaassõitja võiks kanda sobivat kaitseriietust.</answ_one> <answ_two>Rehvirõhk peab olema koormusega kohandatud.</answ_two> <answ_three></answ_three> <bin_answ>11</bin_answ> <picture></picture> <category>a</category> <language>est</language> </question> </testquestion> <testquestion> <id>4</id> <answer>110</answer> <answer_correct>1</answer_correct> <date>2014-02-19</date> <question> <id>4</id> <name>Millele peate tähelepanu pöörama, kui soovite mootorrattale peale võtta kaassõitja?</name> <answ_one>Millele peate tähelepanu pöörama, kui soovite mootorrattale peale võtta kaassõitja?</answ_one> <answ_two>Mootorrattal peab olema kaassõitja jaoks ettenähtu...</answ_two> <answ_three>Asulasisestel teedel sõites pole kaassõitjal motokiivrit vaja.</answ_three> <bin_answ>110</bin_answ> <picture></picture> <category>a</category> <language>est</language> </question> </testquestion> </testquestions> </data> </node>
XML Skeemifail
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="node"> <xs:complexType> <xs:sequence> <xs:element name="result"> <xs:complexType> <xs:sequence> <xs:element type="xs:int" name="id"/> <xs:element type="xs:string" name="success"/> <xs:element type="xs:string" name="message"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="data"> <xs:complexType> <xs:sequence> <xs:element name="user"> <xs:complexType> <xs:sequence> <xs:element type="xs:int" name="id"/> <xs:element type="xs:string" name="name"/> <xs:element type="xs:string" name="email"/> <xs:element type="xs:string" name="hash"/> <xs:element type="xs:date" name="birthday"/> <xs:element type="xs:string" name="school"/> <xs:element type="xs:date" name="reg_date"/> <xs:element type="xs:date" name="last_seen"/> <xs:element type="xs:long" name="facebook_id"/> <xs:element type="xs:int" name="level"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="tests"> <xs:complexType> <xs:sequence> <xs:element name="test" maxOccurs="unbounded" minOccurs="0"> <xs:complexType> <xs:sequence> <xs:element type="xs:int" name="id"/> <xs:element type="xs:int" name="type"/> <xs:element type="xs:string" name="start_date"/> <xs:element type="xs:string" name="end_date"/> <xs:element type="xs:short" name="time_count"/> <xs:element type="xs:int" name="question_count"/> <xs:element type="xs:int" name="correct_count"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="schools"> <xs:complexType> <xs:sequence> <xs:element name="school" maxOccurs="unbounded" minOccurs="0"> <xs:complexType> <xs:sequence> <xs:element type="xs:int" name="id"/> <xs:element type="xs:string" name="name"/> <xs:element type="xs:string" name="agent"/> <xs:element type="xs:string" name="address"/> <xs:element type="xs:long" name="mobile"/> <xs:element type="xs:string" name="number"/> <xs:element type="xs:string" name="email"/> <xs:element type="xs:float" name="rating"/> <xs:element name="reviews"> <xs:complexType> <xs:sequence> <xs:element name="review" maxOccurs="unbounded" minOccurs="0"> <xs:complexType> <xs:sequence> <xs:element type="xs:int" name="id"/> <xs:element type="xs:string" name="user_name"/> <xs:element type="xs:int" name="stars"/> <xs:element type="xs:string" name="comment"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="testquestions"> <xs:complexType> <xs:sequence> <xs:element name="testquestion" maxOccurs="unbounded" minOccurs="0"> <xs:complexType> <xs:sequence> <xs:element type="xs:int" name="id"/> <xs:element type="xs:int" name="answer"/> <xs:element type="xs:int" name="answer_correct"/> <xs:element type="xs:date" name="date"/> <xs:element name="question"> <xs:complexType> <xs:sequence> <xs:element type="xs:int" name="id"/> <xs:element type="xs:string" name="name"/> <xs:element type="xs:string" name="answ_one"/> <xs:element type="xs:string" name="answ_two"/> <xs:element type="xs:string" name="answ_three"/> <xs:element type="xs:int" name="bin_answ"/> <xs:element type="xs:string" name="picture"/> <xs:element type="xs:string" name="category"/> <xs:element type="xs:string" name="language"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>
XML Stiilifail
Üldine vaade test andmetele
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <body> <xsl:if test="node/data/user"> <h2>Minu kasutaja</h2> <table border="1"> <tr bgcolor="#9acd32"> <th>Nimi</th> <th>Email</th> <th>Sünnipäev</th> <th>Autokool</th> <th>Registreeritud</th> </tr> <xsl:for-each select="node/data/user"> <tr> <td><xsl:value-of select="name"/></td> <td><xsl:value-of select="email"/></td> <td><xsl:value-of select="birthday"/></td> <td><xsl:value-of select="school"/></td> <td><xsl:value-of select="reg_date"/></td> </tr> </xsl:for-each> </table> </xsl:if> <xsl:if test="node/data/tests"> <h2>Minu ajalugu</h2> <table border="1"> <tr bgcolor="#9acd32"> <th>Tüüp</th> <th>Alustatud</th> <th>Lõpetatud</th> <th>Küsimusi</th> <th>Testi aeg</th> </tr> <xsl:for-each select="node/data/tests/test"> <tr> <td><xsl:choose> <xsl:when test="type = 0" > ARKi eksam </xsl:when> <xsl:when test="type = 1" > Kooli eksam </xsl:when> <xsl:otherwise> Harjutamine </xsl:otherwise></xsl:choose></td> <td><xsl:value-of select="start_date"/></td> <td> <xsl:choose> <xsl:when test="end_date != ''" > <xsl:value-of select="end_date"/> </xsl:when> <xsl:otherwise> Jätka </xsl:otherwise></xsl:choose> </td> <td> <xsl:choose> <xsl:when test="end_date != ''" > <xsl:value-of select="correct_count"/>/<xsl:value-of select="question_count"/> - <xsl:value-of select="100 div question_count*correct_count"/>% </xsl:when> <xsl:otherwise> <xsl:value-of select="question_count"/> </xsl:otherwise></xsl:choose> </td> <td><xsl:choose> <xsl:when test="end_date != ''" > Kulus <xsl:value-of select="round(question_count - time_count div 60)"/> minutit </xsl:when> <xsl:otherwise> Aega jäänud <xsl:value-of select="round(time_count div 60)"/> minutit </xsl:otherwise></xsl:choose> </td> </tr> </xsl:for-each> </table> </xsl:if> <xsl:if test="node/data/testquestions"> <h2>Test id = <xsl:value-of select="node/data/testquestions/testquestion/id"/> </h2> <table border="1"> <tr bgcolor="#9acd32"> <th>Vastus</th> <th>Õige vastus</th> <th>Kuupäev</th> <th>Küsimus</th> </tr> <xsl:for-each select="node/data/testquestions/testquestion"> <tr> <td><xsl:value-of select="answer"/></td> <td> <xsl:choose> <xsl:when test="answer_correct = 0" > Ei </xsl:when> <xsl:otherwise> Jah </xsl:otherwise></xsl:choose> </td> <td><xsl:value-of select="date"/></td> <td> <table border="1"> <tr bgcolor="#9aFF32"> <th>Küsimus</th> <th>Vastus1</th> <th>Vastus2</th> <th>Vastus3</th> </tr> <tr> <td><xsl:value-of select="question/name"/></td> <td><xsl:value-of select="question/answ_one"/></td> <td><xsl:value-of select="question/answ_two"/></td> <td><xsl:value-of select="question/answ_three"/></td> </tr> </table> </td> </tr> </xsl:for-each> </table> </xsl:if> <xsl:if test="node/data/schools"> <h2>Minu ajalugu</h2> <table border="1"> <tr bgcolor="#9acd32"> <th>Nimi</th> <th>Esindaja</th> <th>Aadress</th> <th>Mobiil</th> <th>Lauatelefon</th> <th>Email</th> <th>Hinne</th> <th>Ülevaated</th> </tr> <xsl:for-each select="node/data/schools/school"> <tr> <td><xsl:value-of select="name"/></td> <td><xsl:value-of select="agent"/></td> <td><xsl:value-of select="address"/></td> <td><xsl:value-of select="mobile"/></td> <td><xsl:value-of select="number"/></td> <td><xsl:value-of select="email"/></td> <td><xsl:value-of select="rating"/></td> <td> <xsl:if test="reviews"> <table border="1"> <tr bgcolor="#9acd32"> <th>Nimi</th> <th>Hinne</th> <th>Hinnang</th> </tr> <xsl:for-each select="reviews/review"> <tr> <td><xsl:value-of select="user_name"/></td> <td><xsl:value-of select="stars"/></td> <td><xsl:value-of select="comment"/></td> </tr> </xsl:for-each> </table> </xsl:if> </td> </tr> </xsl:for-each> </table> </xsl:if> </body> </html> </xsl:template> </xsl:stylesheet>
Teenus
Tegemisel...
Klientrakendus
Tegemisel...
Logi
15.03.2014
- XML retsensioonid valmis
05.03.2014
- XML Wikisse laadimine
04.03.2014
- XML fail sai valmis