Jump to content
Sign in to follow this  
riyong

XML Schemas definition HELP!

Recommended Posts

Anyone please help me if I am doing right ???
Create an XML Schemas definition for your course structure. Put reasonable constraints on the various values. (You don't need to go overboard, though. If you're unsure about something, make it xsd:text.)
XML CODE
<schedule>
<course>
<department>Engineering</department>
<course_name>Mechanical</course_name>
<course_number>101</course_number>
<instructor>Tony Stark</instructor>
<course_type lab="true" lecture="false">Hands on</course_type>
<time>10:00 AM</time>
<room>401</room>
</course>
<course>
<department>Medicine</department>
<course_name>Brain surgery</course_name>
<course_number>101</course_number>
<instructor>Doctor Octavious</instructor>
<course_type lab="true" lecture="false">Hands on</course_type>
<time>10:00 AM</time>
<room>501</room>
</course>
</schedule>
XML SCHEMA
<?xml version="1.0"?>
<xsd:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xsd:element name="schedule"">
<xsd:complexType>
<xsd:sequence>
<xsd:element name ="course" type = "xsd:string"/>
<xsd:element name="Engineering" type="xsd:string"/>
<xsd:element name= "course_name" type="xsd:string"/>
<xsd:element name="course_number" type="xsd:string"/>
<xsd:element name="instructor" type="xsd:string"/>
<xsd:element name="course_type" type="xsd:string" lab="true" lecture="false">Hands on</xsd:course_type>
<xsd:element name = "time" type="xsd:string"/>
<xsd:element name ="room" type="xsd:string"/>
</xsd:course>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
Edited by riyong

Share this post


Link to post
Share on other sites

XML SCHEMA

 

<?xml version="1.0"?>
<xsd:schema
elementFormDefault="qualified">
<xsd:element name="schedule">
<xsd:complexType>
<xsd:sequence>
<xsd:element name ="course" type = "xsd:string"/>
<xsd:element name="Engineering" type="xsd:string"/>
<xsd:element name= "course_name" type="xsd:string"/>
<xsd:element name="course_number" type="xsd:integer"/>
<xsd:element name="instructor" type="xsd:string"/>
<xsd:element name="course_type" type="xsd:boolean"/>
<xsd:element name = "time" type="xsd:decimal"/>
<xsd:element name ="room" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
Edited by riyong

Share this post


Link to post
Share on other sites
<?xml version="1.0"?>
<xsd:schema
elementFormDefault="qualified">
<xsd:element name="schedule">
<xsd:complexType>
<xsd:sequence>
<xsd:element name ="course" type = "xsd:string"/>
<xsd:element name="Engineering" type="xsd:string"/>
<xsd:element name= "course_name" type="xsd:string"/>
<xsd:element name="course_number" type="xsd:integer"/>
<xsd:element name="instructor" type="xsd:string"/>
<xsd:element name="course_type" type="xsd:boolean"/>
<xsd:element name = "time" type="xsd:decimal"/>
<xsd:element name ="room" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...