You are on page 1of 2

7.

Xml Schema definition for a given xml document


Register No:11306621054
MC 1803 - xml and web services lab

<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="talltales">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="tt" type="tttype" minOccurs="1"
maxOccurs="unbounded" />
</xsd:sequence>
<xsd:attribute name="answer" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>

<xsd:complexType name="tttype">
<xsd:sequence>
<xsd:element name="question" type="xsd:string" />
<xsd:element name="a" type="xsd:string" />
<xsd:element name="b" type="xsd:string" />
<xsd:element name="c" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>

XML Document:

<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="talltales.css"?>

<talltales>
<tt answer="a">
<question>
In 1994, a man had an accident while robbing a pizza restaurant in
Akron, Ohio, that resulted in his
arrest. What happened to him?
</question>
<a>He slipped on a patch of grease on the floor and knocked himself
out.</a>
<b>He backed into a police car while attempting to drive off.</b>
<c>He choked on a breadstick that he had grabbed as he was running
out.</c>
</tt>

<tt answer="c">
<question>
In 1993, a man was charged with burglary in Martinsville, Indiana,
after the homeowners discovered his
presence. How were the homeowners alerted to his presence?
</question>
<a>He had rung the doorbell before entering.</a>
<b>He had rattled some pots and pans while making himself a waffle in
their kitchen.</b>
<c>He was playing their piano.</c>
</tt>

<tt answer="a">
<question>
In 1994, the Nestle UK food company was fined for injuries suffered by
a 36 year-old employee at a
plant in York, England. What happened to the man?
</question>
<a>He fell in a giant mixing bowl and was whipped for over a minute.</a>
<b>He developed an ulcer while working as a candy bar tester.</b>
<c>He was hit in the head with a large piece of flying chocolate.</c>
</tt>
</talltales>

CSS Document:

tt {
display: block;
width: 750px;
padding: 10px;
margin-bottom: 10px;
border: 2px double black;
background-color: silver;
}

question {
display: block;
color: black;
font-family: Times, serif;
font-size: 12pt;
text-align: left;
}

a, b, c {
display: block;
color: brown;
font-family: Times, serif;
font-size: 10pt;
text-indent: 15px;
text-align: left;
}

You might also like