Saturday, February 11, 2012

Assignment 11

Xml

Outputting data as XML

1. Out put person as xml raw as elements with a root of 'People'

2. Do an inner join bwtween Person and employee and output the results as xml auto with a root element of "Employees"


Querying XML

3. Select all the fields from the Customer.Autoservice table. Use the xml query() method on the Service description to only return the contents of the description element. Don't forget to account for the namespace.


XML Schema and XML data type

4. Alter the table InspectionDetail that we created in an earlier assignment and drop the xml column Description.

5. Create a new xml schema collection called "DescriptionSchema" using the following schema:

<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" 
 elementFormDefault="qualified" 
 targetNamespace="http://www.automart.com/inspectionDescription" 
 xmlns:xs="http://www.w3.org/2001/XMLSchema">
 <xs:element name="inspectiondescription">
   <xs:complexType>
     <xs:sequence>
  <xs:element name="issue" type="xs:string" />
  <xs:element name="details">
  <xs:complexType>
  <xs:sequence>
  <xs:element maxOccurs="unbounded" 
   name="detail" 
   type="xs:string" />
  </xs:sequence>
  </xs:complexType>
  </xs:element>
         </xs:sequence>
    </xs:complexType>
 </xs:element>
</xs:schema>

6. Now alter the table again, to add the xml column back in, but with schema added:

 Description xml (DescriptionSchema),

7. Insert an new record into the inspection and then the inspectionDetail. You can make up the values, but for the column description enter the following xml:

<?xml version="1.0" encoding="utf-8"?>
<inspectiondescription 
xmlns="http://www.automart.com/inspectionDescription" >
 <issue>
  cleanliness of the work area
 </issue>
 <details>
  <detail>discarded oil rags on counter</detail>
  <detail>Open pan of used oil left 
beside pit where it could be spilled</detail>
  <detail>Tools not cleaned immediately after use</detail>
 </details>
 
</inspectiondescription>


What I am looking for

1-5 are worth 1 point each, 6 is worth 3 and 7 is worth 2 for a total of 10


To Turn in

copy all the code to a google doc and share with spconger@gmail.com

No comments:

Post a Comment