You are on page 1of 3

XML Assignment 1

Given the xml document below. Write schema for the given xml document with the following
requirements:

- Attribute id of PLANT element must be unique.


- The value of the ZONE element in the PLANT element must be the reference ID of the
underlying ZONE element.
- The accepted currency for the plant's cost can only be usd, vnd, jpy, or eur.
- AVAILABILITY is an integer type and has maximum of 6 digits

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


<CATALOG
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:noNamespaceSchemaLocation="plant_catalog.xsd">
<PLANT id="P0001">
<COMMON>Bloodroot</COMMON>
<BOTANICAL>Sanguinaria canadensis</BOTANICAL>
<ZONE>Zone4</ZONE>
<LIGHT>Mostly Shady</LIGHT>
<PRICE currency="usd">2.44</PRICE>
<AVAILABILITY>031599</AVAILABILITY>
</PLANT>
<PLANT id="P0002">
<COMMON>Columbine</COMMON>
<BOTANICAL>Aquilegia canadensis</BOTANICAL>
<ZONE>Zone3</ZONE>
<LIGHT>Mostly Shady</LIGHT>
<PRICE currency="usd">9.37</PRICE>
<AVAILABILITY>030699</AVAILABILITY>
</PLANT>
<PLANT id="P0003">
<COMMON>Marsh Marigold</COMMON>
<BOTANICAL>Caltha palustris</BOTANICAL>
<ZONE>Zone4</ZONE>
<LIGHT>Mostly Sunny</LIGHT>
<PRICE currency="usd">6.81</PRICE>
<AVAILABILITY>051799</AVAILABILITY>
</PLANT>
<PLANT id="P0004">
<COMMON>Cowslip</COMMON>
<BOTANICAL>Caltha palustris</BOTANICAL>
<ZONE>Zone2</ZONE>
<LIGHT>Mostly Shady</LIGHT>
<PRICE currency="usd">9.90</PRICE>
<AVAILABILITY>030699</AVAILABILITY>
</PLANT>
<PLANT id="P0005">
<COMMON>Jack-In-The-Pulpit</COMMON>
<BOTANICAL>Arisaema triphyllum</BOTANICAL>
<ZONE>Zone1</ZONE>
<LIGHT>Mostly Shady</LIGHT>
<PRICE currency="usd">3.23</PRICE>
<AVAILABILITY>020199</AVAILABILITY>
</PLANT>
<PLANT id="P0006">
<COMMON>Mayapple</COMMON>
<BOTANICAL>Podophyllum peltatum</BOTANICAL>
<ZONE>Zone3</ZONE>
<LIGHT>Mostly Shady</LIGHT>
<PRICE currency="usd">2.98</PRICE>
<AVAILABILITY>060599</AVAILABILITY>
</PLANT>
<PLANT id="P0007">
<COMMON>Spring-Beauty</COMMON>
<BOTANICAL>Claytonia Virginica</BOTANICAL>
<ZONE>Zone1</ZONE>
<LIGHT>Mostly Shady</LIGHT>
<PRICE currency="usd">6.59</PRICE>
<AVAILABILITY>020199</AVAILABILITY>
</PLANT>
<PLANT id="P0008">
<COMMON>Trillium</COMMON>
<BOTANICAL>Trillium grandiflorum</BOTANICAL>
<ZONE>Zone5</ZONE>
<LIGHT>Sun or Shade</LIGHT>
<PRICE currency="usd">3.90</PRICE>
<AVAILABILITY>042999</AVAILABILITY>
</PLANT>
<PLANT id="P0009">
<COMMON>Cardinal Flower</COMMON>
<BOTANICAL>Lobelia cardinalis</BOTANICAL>
<ZONE>Zone2</ZONE>
<LIGHT>Shade</LIGHT>
<PRICE currency="usd">3.02</PRICE>
<AVAILABILITY>02229</AVAILABILITY>
</PLANT>

<ZONE id="Zone1">
<NAME>Africa</NAME>
<DESCRIPTION>The second largest continent on Earth, Africa is about three
times as large as the entire United States</DESCRIPTION>
</ZONE>
<ZONE id="Zone2">
<NAME>Asia</NAME>
<DESCRIPTION>Asia is the planet's largest and most populous
continent.</DESCRIPTION>
</ZONE>
<ZONE id="Zone3">
<DESCRIPTION>Central America lies between North and South
America</DESCRIPTION>
<NAME>Central America</NAME>
</ZONE>
<ZONE id="Zone4">
<NAME>Oceania</NAME>
<DESCRIPTION>Oceania is a unique region consisting of Australia, New
Zealand and over a dozen island nations</DESCRIPTION>
</ZONE>
<ZONE id="Zone5">
<DESCRIPTION>Despite its small size, the Caribbean was perhaps designated as
its own region by DHS</DESCRIPTION>
<NAME>The Caribbean</NAME>
</ZONE>
</CATALOG>

You might also like