Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The Our Lady of Bergen Historical Society Sharon Strattan is an archivist at the Our Lady of Bergen Historical Society in Bergenfield, New Jersey. The

The Our Lady of Bergen Historical Society Sharon Strattan is an archivist at the Our Lady of Bergen Historical Society in Bergenfield, New Jersey. The historical society is exploring how to transfer its listings to XML format, and Sharon has begun by creating a sample document of the societys extensive collection of photos. As part of this process, shes asked for your help in developing the schema that will be used to validate the XML documents. She has created a sample document to work on. Eventually, your work will be used in a much larger system. The structure of the sample document is shown in Figure 3-40.

Figure 3-40 The catalog vocabulary structure

image text in transcribed

Figure 3-41 describes the elements and attributes in this sample document as well as the rules that govern the data that can be entered into a valid document.

Figure 3-41 The catalog vocabulary

image text in transcribed

Your job will be to express this document structure and set of rules in terms of the XML Schema language, and then to validate Sharons document based on the schema you create.

Complete the following:

1. Using your XML editor, open the catalogtxt.xml and catalogtxt.xsd files from the xml03 case1 folder, enter your name and todays date in the comment section of each file, and then save the files as catalog.xml and catalog.xsd, respectively.

2. Go to the catalog.xsd file in your text editor. Add the root schema element to the document and declare the XML Schema namespace using the xs prefix.

3. Attach the schema file catalog.xsd to the instance document, indicating that the schema and instance document do not belong to any namespace

4. Create the following named simple types:

a. cidType, based on the ID data type and restricted to the regular expression pattern c\d{4}

b. srcType, based on the string data type and restricted to the regular expression pattern [a-zA-Z0-9]+.jpg

5. Declare the catalog element containing the child element photo. The photo element must occur at least once, but its upper limit is unbounded.

6. Declare the photo element containing the following sequence of nested child elementsname, description, date, and images. Set the following properties for the nested elements:

a. All of the child elements should contain string data. The name element should also support the metadata attribute.

b. The cid attribute is required. The donatedBy attribute is optional.

7. Declare the img element. It has no content and contains a required attribute, src.

8. Declare the following attributes and elements:

a. The attribute metadata must have the string data type.

b. The attribute cid must have the cidType data type.

c. The attribute src must have the srcType data type.

d. The attribute donatedBy must have the string data type.

e. The element description must have the string data type.

f. The element date must have the string data type.

9. Save your changes to the catalog.xsd file, and then validate the schema. Continue to correct any validation errors you discover until the schema validates.

10. Validate the catalog.xml file against the schema. Continue to correct any validation errors you discover until the instance document validates.

Also, please try to indent.

Element or Attribute Description catalog The root element photo The collection of information about a photo cid The ID number of the catalog with the format c\#\#\#\#, where \# is a digit donatedBy The name of the donor name The name of the photo metadata The metadata for the photo description The description of the photo date The approximate date of the photo images The collection of img elements ing The element that references the image file src The source file containing the image; must end with .jpg

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Design Implementation And Management

Authors: Peter Rob, Carlos Coronel

6th International Edition

061921323X, 978-0619213237

More Books

Students also viewed these Databases questions