Instance Document


The Schema described earlier validates the instance document shown in Listing 4.4.

Listing 4.4: Sample XML instance document

image from book
 <?xml version="1.0" encoding="ISO-8859-1"?> <root:Insured       xmlns:root="http://www.highlight.com/Insurance"       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"       xsi:schemaLocation=          "http://www.ibm.com/HighlightInsurance Insurance.xsd"       Customer>    <CarPolicy PolicyType="Auto">       <Vehicle VIN="A123">          <Make>Honda</Make>          <Model>Accord</Model>       </Vehicle>       <Vehicle VIN="A456">          <Make>Ford</Make>          <Model>Mustang</Model>       </Vehicle>    </CarPolicy>    <CarPolicy PolicyType="Antique Auto">       <Vehicle VIN="B321">          <Make>Triumph</Make>          <Model>Spitfire</Model>       </Vehicle>       <Vehicle VIN="B654">          <Make>Buick</Make>          <Model>Skylark</Model>       </Vehicle>       <Vehicle VIN="B987">          <Make>Porsche</Make>          <Model>Speedster</Model>       </Vehicle>    </CarPolicy> </root:Insured> 
image from book

We qualify Insured with the target namespace because that name is defined in a global element of the XML Schema. We cannot qualify the other names without causing a Schema validation error, because the Schema element elementFormDefault is set to unqualified.

After we declare a non-default namespace and use it to qualify Insured, we use the prefix xsi to specify an XML-related namespace and to set the attribute schemaLocation.

 xsi:schemaLocation=            "http://www.ibm.com/HighlightInsurance Insurance.xsd" 

The setting of schemaLocation repeats the target namespace and tells the location of the XML Schema. The attribute setting is only a hint to the XML processor, which may be configured to use a different Schema.




SOA for the Business Developer. Concepts, BPEL, and SCA
SOA for the Business Developer: Concepts, BPEL, and SCA (Business Developers series)
ISBN: 1583470654
EAN: 2147483647
Year: 2004
Pages: 157
Authors: Ben Margolis

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net