H
HugeBob
Hi All,
I have this XML schema and instance that I'm having trouble with. The
schema and instance are below. I tried validating the pair. But I
get an error saying "Cannot find the declaration of element 'vendor'."
Schema (autos.xsd)
<?xml version="1.0" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:auto="http://www.autos.com/data"
targetNamespace="http://www.autos.com/data">
<xs:element name="vendor">
<xs:complexType>
<xs:all>
<xs:element name="title" type="xs:string"/>
<xs:element name="introduction" type="xs:string"/>
<xs:element name="advertisement" type="xs:string"/>
<xs:element name="auto">
<xs:complexType>
<xs:all>
<xs:element name="auto_name" type="xs:string"/>
<xs:element name="year" type="xs:integer"/>
<xs:element name="mileage" type="xs:integer"/>
<xs:element name="description" type="xs:string"/>
<xs:element name="price" type="xs:decimal"/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
Instance (autos.xml)
<?xml version="1.0"?>
<vendor xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:auto="http://www.autos.com/data"
xsi:schemaLocation="http://www.autos.com/data autos.xsd">
<title>JHU Used Car Sales</title>
<introduction>blah, blah, blah</introduction>
<advertisement>blah blah blah</advertisement>
<auto>
<auto_name>Honda Civic</auto_name>
<year>1991</year>
<mileage>175</mileage>
<description>Perfect Condition (Don't mind the rust)</description>
<price>1199.00</price>
</auto>
<auto>
<auto_name>Chevy Vega</auto_name>
<year>1976</year>
<mileage>96</mileage>
<description>Overheat occasionally</description>
<price>699.00</price>
</auto>
<auto>
<auto_name>Nissan Xterra</auto_name>
<year>2004</year>
<mileage>14</mileage>
<description>Fully loaded</description>
<price>22500.00</price>
</auto>
<auto>
<auto_name>Jeep Wrangler</auto_name>
<year>2000</year>
<mileage>65</mileage>
<description>Runs well if its not raining</description>
<price>9999.00</price>
</auto>
<auto>
<auto_name>Dodge Charger</auto_name>
<year>1986</year>
<mileage>110</mileage>
<description>Really is a good car, just a bad design</description>
<price>899.00</price>
</auto>
</vendor>
I have this XML schema and instance that I'm having trouble with. The
schema and instance are below. I tried validating the pair. But I
get an error saying "Cannot find the declaration of element 'vendor'."
Schema (autos.xsd)
<?xml version="1.0" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:auto="http://www.autos.com/data"
targetNamespace="http://www.autos.com/data">
<xs:element name="vendor">
<xs:complexType>
<xs:all>
<xs:element name="title" type="xs:string"/>
<xs:element name="introduction" type="xs:string"/>
<xs:element name="advertisement" type="xs:string"/>
<xs:element name="auto">
<xs:complexType>
<xs:all>
<xs:element name="auto_name" type="xs:string"/>
<xs:element name="year" type="xs:integer"/>
<xs:element name="mileage" type="xs:integer"/>
<xs:element name="description" type="xs:string"/>
<xs:element name="price" type="xs:decimal"/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
Instance (autos.xml)
<?xml version="1.0"?>
<vendor xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:auto="http://www.autos.com/data"
xsi:schemaLocation="http://www.autos.com/data autos.xsd">
<title>JHU Used Car Sales</title>
<introduction>blah, blah, blah</introduction>
<advertisement>blah blah blah</advertisement>
<auto>
<auto_name>Honda Civic</auto_name>
<year>1991</year>
<mileage>175</mileage>
<description>Perfect Condition (Don't mind the rust)</description>
<price>1199.00</price>
</auto>
<auto>
<auto_name>Chevy Vega</auto_name>
<year>1976</year>
<mileage>96</mileage>
<description>Overheat occasionally</description>
<price>699.00</price>
</auto>
<auto>
<auto_name>Nissan Xterra</auto_name>
<year>2004</year>
<mileage>14</mileage>
<description>Fully loaded</description>
<price>22500.00</price>
</auto>
<auto>
<auto_name>Jeep Wrangler</auto_name>
<year>2000</year>
<mileage>65</mileage>
<description>Runs well if its not raining</description>
<price>9999.00</price>
</auto>
<auto>
<auto_name>Dodge Charger</auto_name>
<year>1986</year>
<mileage>110</mileage>
<description>Really is a good car, just a bad design</description>
<price>899.00</price>
</auto>
</vendor>