0% found this document useful (0 votes)
99 views2 pages

Csc570 XML Programming Lab 9 (XML Schema) XML File: Shiporder - XML

This document provides instructions for an XML programming lab assignment. Students are asked to create an XML Schema file (shiporder.xsd) that validates an XML file (shiporder.xml) about a ship order. The schema must define elements and attributes that meet specific requirements, such as allowing multiple <item> elements but only one <shipto> element. Students are also asked to modify shiporder.xml to reference an external DTD file (shiporder.dtd) and create that DTD file to validate certain elements and attributes. Files are due by a specified date.
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)
99 views2 pages

Csc570 XML Programming Lab 9 (XML Schema) XML File: Shiporder - XML

This document provides instructions for an XML programming lab assignment. Students are asked to create an XML Schema file (shiporder.xsd) that validates an XML file (shiporder.xml) about a ship order. The schema must define elements and attributes that meet specific requirements, such as allowing multiple <item> elements but only one <shipto> element. Students are also asked to modify shiporder.xml to reference an external DTD file (shiporder.dtd) and create that DTD file to validate certain elements and attributes. Files are due by a specified date.
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/ 2

CSC570 XML PROGRAMMING

Lab 9 (XML Schema)

XML file: shiporder.xml:

<?xml version="1.0" encoding="UTF-8"?>

<shiporder orderid="st889923"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="shiporder.xsd">

<orderperson>John Smith</orderperson>
<orderdate>2015-12-27</orderdate>
<trackcode>CS2001</trackcode>
<shipto>
<name>Ola Nordmann</name>
<address>Langgt 23</address>
<city>4000 Stavanger</city>
<country>Norway</country>
</shipto>
<item>
<title>Empire Burlesque</title>
<note stock=”yes”>Special Edition</note>
<quantity>1</quantity>
<price>10.90</price>
</item>
<item>
<title>Hide your heart</title>
<quantity>4</quantity>
<price>9.90</price>
</item>
</shiporder>

QUESTION 1

Based on the XML file, create a validating XSD file – “shiporder.xsd”. Please bare in-mind
some elements must conform to specific patterns:

a) The "item" element can appears multiple times, but “shipto” element only one time.
b) “shipto” child elements can appear in any order but “item” child elements must appear in
order.
c) “note” element is optional, but if included -- the attribute “stock” is required.
d) Attribute “stock” value must be between “yes” or “no”
e) Attribute “orderid” under “shiporder” element is required
f) Restriction for “trackcode” value: it should have totally 6 characters in which the first 2 are
uppercase alphabets and the remaining 4 are numbers.
g) Restriction for “quantity” value: only accept integer value 1 to 100.
h) Data type for “price” is decimal and “orderdate” is date
QUESTION 2

Modify “shiporder.xml” to make a reference to external DTD file “shiporder.dtd”. Save as


“shiporderdtd.xml”. Create a validating DTD file “shiporder.dtd” that conform to the
requirement:

a) The "item" element can appears multiple times, but “shipto” element only one time.
b) “note” element is optional, but if included -- the attribute “stock” is required.
c) Attribute “stock” value must be between “yes” or “no”
d) Attribute “orderid” under “shiporder” element is required

Submit all your files (shiporder.xml, shiporderdtd.xml, shiporder.xsd & shiporder.dtd) to


[email protected] using the following as subject/title:

(Lab 9/studID1 & studID2/Group)

Submission date: 13/12/2017 (Group B), 17/12/2017 (Group A) before midnight. Late
submission will not be accepted.

You might also like