I really need help with this question. Please Write three XML Schemas (.xsd) for
ID: 3709395 • Letter: I
Question
I really need help with this question. Please
Write three XML Schemas (.xsd) for Report.xml. The XML instance (Report.xml) must be valid against the three schemas. The three schemas should follow the “all_in_one” style, “separate_definiations” style, and “name_types” style respectively.
The following is the Report.xml
<?xml version="1.0" encoding="UTF-8"?>
<Report>
<Metadata>
<Author>
<Name>Xi Niu</Name>
<Email>xiniu@iupui.edu</Email>
</Author>
<Assignment>
<Course>Info I308 Information Representation</Course>
<Date>8/21/2013</Date>
<Title>Title of Assignment</Title>
<Description>Short (1 or 2 sentences) description of the
assignment.</Description>
</Assignment>
</Metadata>
<Body>
<Section title="Section 1 title">
<Para>Paragraph 1 goes here</Para>
<Para>Paragraph 2 goes here</Para>
</Section>
<Section title="Section 2 title">
<Para>Paragraph 1 goes here</Para>
<Para>Paragraph 2 goes here</Para>
</Section>
</Body>
</Report>
Explanation / Answer
Below is the xsd with 3 schemae, with 3 different elements -
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="Report">
<xs:complexType>
<xs:sequence>
<xs:element name="Metadata">
<xs:complexType>
<xs:sequence>
<xs:element name="Author">
<xs:complexType>
<xs:sequence>
<xs:element name="Name" type="xs:string"></xs:element>
<xs:element name="Email" type="xs:string"></xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Assignment">
<xs:complexType>
<xs:sequence>
<xs:element name="Course" type="xs:string"></xs:element>
<xs:element name="Date" type="xs:string"></xs:element>
<xs:element name="Title" type="xs:string"></xs:element>
<xs:element name="Description" type="xs:string"></xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Body">
<xs:complexType>
<xs:sequence>
<xs:element name="Section" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="Para" maxOccurs="unbounded" type="xs:string"></xs:element>
</xs:sequence>
<xs:attribute name="title" type="xs:string"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>