Starting from:

$25

Web_Technology - Week 8 Exercise -Solved

Introduction to Web Technology 

 Lab Programming  

 

Here is a sample of XSD code: 

<?xml version="1.0" ?>

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

  . . .

</xsd:schema>
 

Question 1. Given the following XML code containing an exam result where score is an integer; and contestant id, exam id, band and digital signature are strings. Your task is to write the corresponding XSD code and save it into the file q1.xsd. 

 

<?xml version="1.0"?>

<result ref="10007629P">

  <contestantId>00025142</contestantId>

  <examId>KB253DG</examId>

  <score>156</score>

  <band>C</band>

  <digitalSignature>a720cf8e23bc1256bce2</digitalSignature> </result>
 

Question 2. Copy the code from q1.xsd to q2.xsd.​     In q2.xsd, add the following restrictions: 

●     Band values must be A, B, C or D. 

●     Score values must be an integer between 0 and 300. 

Here is a sample of restriction code: 

<xsd:restriction base="xsd:integer">

  <xsd:minInclusive value="0" />

  <xsd:maxInclusive value="100" />

</xsd:restriction>

 

<xsd:restriction base="xsd:string">

  <xsd:enumeration value="LARGE" />

  <xsd:enumeration value="MEDIUM" />

  <xsd:enumeration value="SMALL" />

</xsd:restriction>
Page 1 of 2 

 

 

Question 3. Given the following XML code.​  

Your task is to write the corresponding XSD code and save it into the file q3.xsd. 

 

<?xml version="1.0"?>

<audit campus="Woolloomooloo" year="2000" session="A">

 

  <subject sid="0769642">

    <code>MATH101</code>

    <title>Calculus</title>

    <statistics>

      <enrol>170</enrol>

      <withdrawn>31</withdrawn>

    </statistics>

  </subject>

 

  <subject sid="1734231">

    <code>MATH234</code>

    <title>Abstract Algebra</title>

    <statistics>

      <enrol>40</enrol>

      <withdrawn>15</withdrawn>

    </statistics>

  </subject>

 

</audit>
 

 

 

 

 

More products