<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[CS311 Assignment 2 Solution and Discussion]]></title><description><![CDATA[<p dir="auto">Assignment No. 02<br />
Semester: Fall 2019<br />
Introduction to Web Services Development – CS311	<br />
Total Marks: 20</p>
<p dir="auto">Due Date: 4/12/2019</p>
<p dir="auto">Objectives:<br />
Understand and get hands on experience of<br />
•	XML schema<br />
•	Generating XML schema (XSD) of a given XML<br />
•	Generate XML using PHP<br />
Instructions:<br />
Please read the following instructions carefully before submitting assignment:<br />
It should be clear that your assignment will not get any credit if:</p>
<p dir="auto">	The assignment is submitted after due date.<br />
	The assignment is submitted via email.<br />
	The assignment is copied from Internet or from any other student.<br />
	The submitted assignment does not open or file is corrupt.<br />
	It is in some format other than .doc/.docx.</p>
<p dir="auto">Note: All types of plagiarism are strictly prohibited.</p>
<p dir="auto">For any query about the assignment, contact at <a href="mailto:CS311@vu.edu.pk" target="_blank" rel="noopener noreferrer nofollow ugc">CS311@vu.edu.pk</a></p>
<p dir="auto">Consider the well-formed XML given below. You are required to:</p>
<ol>
<li>Write XML Schema (.xsd) code for the given XML</li>
<li>Generate the following XML on a server as output using PHP</li>
</ol>
<pre><code>&lt;?xml version="1.0"?&gt;
&lt;BookStore&gt;
   &lt;Book&gt;
   	&lt;Title&gt;Introduction to Computing&lt;/Title&gt;
   	&lt;Course&gt;CS101&lt;/Course&gt;
   	&lt;Year&gt;2016&lt;/Year&gt;
   	&lt;Publisher&gt;Virtual University of Pakistan&lt;/Publisher&gt;
   	&lt;Author&gt;Dr Tanveer Ahmad&lt;/Author&gt;
   &lt;/Book&gt;
   &lt;Book&gt;
   	&lt;Title&gt;Object Oriented Programming&lt;/Title&gt;
   	&lt;Course&gt;CS304&lt;/Course&gt;
   	&lt;Year&gt;2017&lt;/Year&gt;
   	&lt;Publisher&gt;Virtual University of Pakistan&lt;/Publisher&gt;
   	&lt;Author&gt;Dr Shafeeq&lt;/Author&gt;
   &lt;/Book&gt;
&lt;/BookStore&gt;
</code></pre>
<p dir="auto">Assignment Uploading Instructions:</p>
<p dir="auto">•	You need to upload your assignment in .doc/.docx file format.<br />
•	Copy your code for both the questions and paste it in word file(.doc/.docx) and then upload your assignment</p>
<p dir="auto">Please note that due date of assignment will not extend, so do not wait for last date and submit your solution as quickly as possible.</p>
]]></description><link>https://community.secnto.com//topic/741/cs311-assignment-2-solution-and-discussion</link><generator>RSS for Node</generator><lastBuildDate>Mon, 08 Jun 2026 23:01:17 GMT</lastBuildDate><atom:link href="https://community.secnto.com//topic/741.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 04 Dec 2019 08:05:26 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to CS311 Assignment 2 Solution and Discussion on Thu, 05 Dec 2019 08:46:47 GMT]]></title><description><![CDATA[<p dir="auto"><strong>Solution Ideas:</strong></p>
<ol>
<li>Write XML Schema (.xsd) code for the given XML</li>
</ol>
<p dir="auto">Answer</p>
<pre><code>XSD Code
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt;
  &lt;xs:element name="BookStore"&gt;
    &lt;xs:complexType&gt;
      &lt;xs:sequence&gt;
        &lt;xs:element name="Book" maxOccurs="unbounded"&gt;
          &lt;xs:complexType&gt;
            &lt;xs:sequence&gt;
              &lt;xs:element name="Title" type="xs:string"/&gt;
              &lt;xs:element name="Course" type="xs:string"/&gt;
              &lt;xs:element name="Year" type="xs:unsignedShort"/&gt;
              &lt;xs:element name="Publisher" type="xs:string"/&gt;
              &lt;xs:element name="Author" type="xs:string"/&gt;
            &lt;/xs:sequence&gt;
          &lt;/xs:complexType&gt;
        &lt;/xs:element&gt;
      &lt;/xs:sequence&gt;
    &lt;/xs:complexType&gt;
  &lt;/xs:element&gt;
&lt;/xs:schema&gt;
</code></pre>
<ol start="2">
<li>Generate the following XML on a server as output using PHP<br />
Answer<br />
PHP CODE</li>
</ol>
<pre><code>&lt;?php
header("Content-type: text/xml");
echo"&lt;BookStore&gt;";
echo"&lt;Book&gt;";
echo"&lt;Title&gt;Introduction to Computing&lt;/Title&gt;";
echo"&lt;Course&gt;CS101&lt;/Course&gt;";
echo"&lt;Year&gt;2016&lt;/Year&gt;";
echo"&lt;Publisher&gt;Virtual University of Pakistan &lt;/Publisher&gt;";
echo"&lt;Author&gt;Dr Tanveer Ahmad&lt;/Author&gt;";
echo"&lt;/Book&gt;";
echo"&lt;Book&gt;";
echo"&lt;Title&gt;Object Oriented Programming&lt;/Title&gt;";
echo"&lt;Course&gt;CS304&lt;/Course&gt;";
echo"&lt;Year&gt;2017&lt;/Year&gt;";
echo"&lt;Publisher&gt;Virtual University of Pakistan&lt;/Publisher&gt;";
echo"&lt;Author&gt;Dr Shafeeq&lt;/Author&gt;";
echo"&lt;/Book&gt;";
echo"&lt;/BookStore&gt;";
?&gt;
</code></pre>
<p dir="auto">PHP OUTPUT</p>
]]></description><link>https://community.secnto.com//post/2206</link><guid isPermaLink="true">https://community.secnto.com//post/2206</guid><dc:creator><![CDATA[zareen]]></dc:creator><pubDate>Thu, 05 Dec 2019 08:46:47 GMT</pubDate></item></channel></rss>