Question: Your job will be to express this document structure and set of rules in terms of the XML Schema language and validate the instance (
Your job will be to express this document structure and set of rules in terms of the XML Schema language and validate the instance XML document based on the schema you create.
Complete the following:
Using your XML editor, open the catalogtxt.xml and catalogtxt.xsd files located below, 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.
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.
Attach the schema file catalog.xsd to the instance document, indicating that the schema and instance document do not belong to any namespace.
Create the following named simple type:
cidType, based on the ID data type and restricted to the regular expression pattern cd
Declare the catalog element containing the child element photo. The photo element must occur at least once, but its upper limit is unbounded.
Declare the photo element containing the following sequence of nested child elementsname description and date. 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.
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.
cThe attribute donatedBy must have the string data type.
dThe element description must have the string data type.
eThe element date must have the string data type.
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.
Validate the catalog.xml file against the schema. Continue to correct any validation errors you discover until the instance document validates.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
