Question: XML Tutorial You are asked to create an XML file for Petes Pet Store. He wants to use the file to display a list of

XML Tutorial

You are asked to create an XML file for Petes Pet Store. He wants to use the file to display a list of adopted pets.

  1. Open the file pets.txt. Using the contents, create an XML document named pets.xml.

  2. The pets.xml file should contain the following items:

    1. An XML prolog.

    2. The root element of the document should be named Pets. The Pets element should

      contain multiple occurrences of a child element named Pet.

    3. The Pet element should have the following child elements: Name, Category, Breed,

      DateAdopted, Gender, Registered, Color, and ListPrice.

    4. The Pet element should have the attribute PetID containing the pet ID of each pet.

    5. The Registered element is not required for each pet. When present, it should contain the pets registration ID.

    6. The Category, Breed, DateAdopted, Gender, and ListPrice contain the pets category, breed, date adopted, gender, and list price accordingly.

  3. Within the documents prolog, insert a comment describing the purpose of the document. Include the filename, your name, and the current date in the comment text.

  4. Attach the pets.xml file to a CSS style sheet named pets.css(included in the data files).

  5. Open pets.xml in your Web browser and verify that there are no errors reported by the XML

    parser within the browser.

pets.txt

PetID: 7 Name:Eugene Category:Cat Breed:Siamese Date Adopted01/25/2011 Gender:Male Registered:CFA Color:Black List Price: $279.54 ======================== PetID: 8 Name:Miranda Category:Dog Breed:Norfolk Terrier Date Adopted05/04/2011 Gender:Female Registered:AKC Color:Red List Price: $203.75 ======================== PetID: 10 Name:Sherri Category:Dog Breed:Siberian Huskie Date Adopted09/13/2011 Gender:Female Registered:AKC Color:Black/White List Price: $166.79 ======================== PetID: 11 Name:Susan Category:Dog Breed:Dalmation Date Adopted01/22/2011 Gender:Female Registered:AKC Color:Spotted List Price: $164.96 ======================== PetID: 12 Name:Leisha Category:Dog Breed:Rottweiler Date Adopted06/13/2011 Gender:Female Registered:AKC Color:Brown List Price: $164.06 ======================== PetID: 13 Name:Sheena Category:Fish Breed:Tetra Date Adopted03/01/2011 Gender:Male Color:Red List Price: $12.00 ======================== PetID: 14 Name:Tina Category:Cat Breed:Sphynx Date Adopted01/06/2011 Gender:Female Registered:CFA Color:Gold List Price: $143.94 ======================== PetID: 15 Name:Bonita Category:Dog Breed:Cocker Spaniel Date Adopted10/21/2011 Gender:Female Registered:AKC Color:Gold List Price: $284.85 ======================== PetID: 16 Name:Lisa Category:Dog Breed:Great Pyrenees Date Adopted01/05/2011 Gender:Female Registered:AKC Color:Brown List Price: $274.35 ======================== PetID: 17 Name:Jackie Category:Dog Breed:Doberman Date Adopted04/12/2011 Gender:Male Registered:AKC Color:Black List Price: $165.73 ======================== PetID: 18 Name:Allison Category:Cat Breed:Manx Date Adopted04/21/2011 Gender:Female Registered:CFA Color:Black List Price: $215.92 ======================== PetID: 21 Name:Debbie Category:Bird Breed:Cockatiel Date Adopted01/14/2011 Gender:Female Color:Blue List Price: $177.88 ======================== PetID: 27 Name:Gina Category:Reptile Breed:Gila Monster Date Adopted03/11/2011 Gender:Male Color:Green List Price: $192.08 ======================== PetID: 28 Name:Harry Category:Spider Breed:Tarantula Date Adopted02/07/2011 Gender:Male Color:Black List Price: $45.00 ======================== PetID: 43 Name:Chelsea Category:Reptile Breed:Python Date Adopted02/10/2011 Gender:Female Color:Black/Gold List Price: $237.90 ========================

pets.css

Pets { background-color: beige; } Pet { display: block; width: 300px; color: black; font-size: 15px; font-family: Arial, Helvetica, sans-serif; border: 5px solid black; background-color: lightblue; margin: 10px; padding: 15px; } Name { display: block; font-size: 20px; letter-spacing: 3px; width: 100%; text-align: center; background-color: white; border: 1px solid yellow; } Category { display: list-item; list-style-type: none; margin-left: 10px; padding: 5px;} Category:before { content: "Category: "; font-weight: bold; } Breed { display: list-item; list-style-type: none; margin-left: 10px; padding: 5px;} Breed:before { content: "Breed: "; font-weight: bold; } DateAdopted { display: list-item; list-style-type: none; margin-left: 10px; padding: 5px;} DateAdopted:before { content: "Adopted: "; font-weight: bold; } Gender { display: list-item; list-style-type: none; margin-left: 10px; padding: 5px;} Gender:before { content: "Gender: "; font-weight: bold; } Registered { display: list-item; list-style-type: none; margin-left: 10px; padding: 5px;} Registered:before { content: "Registered: "; font-weight: bold; } Color { display: list-item; list-style-type: none; margin-left: 10px; padding: 5px;} Color:before { content: "Color: "; font-weight: bold; } ListPrice { display: list-item; list-style-type: none; margin-left: 10px; padding: 5px;} ListPrice:before { content: "List Price: "; font-weight: bold; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!