Error using xsd.exe tool against google xsd?

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Im trying to create a class from the two xsds (google product feed) and getting the following error:
<br/>


Error: Error generating classes for schema product_reviews_v1.
- The element http://schemas.google.com/schemas/pr/1.0:role is missing.

<br/>

The command I am using is:
xsd.exe /c /n:GooglePRoductReview product_reviews_v1.xsd
<br/>

And below is main schema (product_reviews_v1.xsd)
========================


<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:pr="http://schemas.google.com/schemas/pr/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified
<span style="white-space:pre <xs:import namespace="http://schemas.google.com/schemas/pr/1.0" schemaLocation="prs_v1.xsd"/>
<span style="white-space:pre <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/03/xml.xsd"/>
<span style="white-space:pre <xs:element name="feed
<span style="white-space:pre <xs:complexType>
<span style="white-space:pre <xs:sequence>
<span style="white-space:pre <xs:element name="author" type="authorType"/>
<span style="white-space:pre <xs:element name="title" type="titleType" minOccurs="0"/>
<span style="white-space:pre <xs:element name="subtitle" type="titleType" minOccurs="0"/>
<span style="white-space:pre <xs:element ref="published"/>
<span style="white-space:pre <xs:element ref="rights" minOccurs="0"/>
<span style="white-space:pre <xs:element ref="id"/>
<span style="white-space:pre <xs:element ref="link"/>
<span style="white-space:pre <xs:element name="logo" type="xs:anyURI"/>
<span style="white-space:pre <xs:element name="entry" minOccurs="0" maxOccurs="unbounded
<span style="white-space:pre <xs:complexType>
<span style="white-space:pre <xs:sequence>
<span style="white-space:pre <xs:element ref="id"/>
<span style="white-space:pre <xs:element ref="published"/>
<span style="white-space:pre <xs:element name="title" type="titleType"/>
<span style="white-space:pre <xs:element ref="pr:content_format"/>
<span style="white-space:pre <xs:element ref="link"/>
<span style="white-space:pre <xs:element name="author" type="authorType" maxOccurs="unbounded"/>
<span style="white-space:pre <xs:element name="content" type="contentType" minOccurs="0" maxOccurs="unbounded"/>
<span style="white-space:pre <xs:element name="video" type="videoType" minOccurs="0"/>
<span style="white-space:pre <xs:element ref="pr:products" minOccurs="0"/>
<span style="white-space:pre <xs:element ref="pr:pros" minOccurs="0"/>
<span style="white-space:pre <xs:element ref="pr:cons" minOccurs="0"/>
<span style="white-space:pre <xs:element ref="pr:overview" minOccurs="0"/>
<span style="white-space:pre <xs:element ref="pr:awards" minOccurs="0"/>
<span style="white-space:pre <xs:element ref="pr:custom" minOccurs="0" maxOccurs="unbounded"/>
<span style="white-space:pre <xs:element ref="pr:ratings" minOccurs="0"/>
<span style="white-space:pre <xs:element ref="pr:related_products" minOccurs="0"/>
<span style="white-space:pre </xs:sequence>
<span style="white-space:pre </xs:complexType>
<span style="white-space:pre </xs:element>
<span style="white-space:pre <xs:element name="deleted_entry" minOccurs="0" maxOccurs="unbounded
<span style="white-space:pre <xs:complexType>
<span style="white-space:pre <xs:sequence>
<span style="white-space:pre <xs:element ref="id" minOccurs="0" maxOccurs="unbounded"/>
<span style="white-space:pre </xs:sequence>
<span style="white-space:pre </xs:complexType>
<span style="white-space:pre </xs:element>
<span style="white-space:pre </xs:sequence>
<span style="white-space:pre <xs:attribute ref="xml:lang" use="required"/>
<span style="white-space:pre </xs:complexType>
<span style="white-space:pre </xs:element>
<span style="white-space:pre <xs:element name="id" type="xs:string"/>
<span style="white-space:pre <xs:element name="published" type="xs:dateTime"/>
<span style="white-space:pre <xs:element name="rights" type="xs:string"/>
<span style="white-space:pre <xs:element name="link" type="linkType"/>
<span style="white-space:pre <xs:complexType name="authorType
<span style="white-space:pre <xs:all>
<span style="white-space:pre <xs:element name="name" type="xs:string"/>
<span style="white-space:pre <xs:element name="email" type="xs:string" minOccurs="0"/>
<span style="white-space:pre <xs:element ref="pr:role" minOccurs="0"/>
<span style="white-space:pre <xs:element ref="pr:number_of_reviews" minOccurs="0"/>
<span style="white-space:pre <xs:element ref="link" minOccurs="0"/>
<span style="white-space:pre <xs:element ref="pr:author_rating" minOccurs="0"/>
<span style="white-space:pre </xs:all>
<span style="white-space:pre </xs:complexType>
<span style="white-space:pre <xs:complexType name="videoType
<span style="white-space:pre <xs:all>
<span style="white-space:pre <xs:element ref="published" minOccurs="0"/>
<span style="white-space:pre <xs:element name="title" type="titleType" minOccurs="0"/>
<span style="white-space:pre <xs:element ref="link"/>
<span style="white-space:pre <xs:element name="summary" type="xs:string" minOccurs="0"/>
<span style="white-space:pre </xs:all>
<span style="white-space:pre </xs:complexType>
<span style="white-space:pre <xs:complexType name="contentType" mixed="true
<span style="white-space:pre <xs:attribute name="full_length" type="xs:nonNegativeInteger" use="optional"/>
<span style="white-space:pre </xs:complexType>
<span style="white-space:pre <xs:complexType name="linkType
<span style="white-space:pre <xs:attribute name="href" type="xs:anyURI" use="required"/>
<span style="white-space:pre <xs:attribute name="rel" type="xs:NCName" use="required"/>
<span style="white-space:pre <xs:attribute name="type"/>
<span style="white-space:pre </xs:complexType>
<span style="white-space:pre <xs:complexType name="titleType" mixed="true
<span style="white-space:pre <xs:attribute name="type" type="xs:NCName" use="required"/>
<span style="white-space:pre </xs:complexType>
</xs:schema>


<br/>

And below is the nested schema (prs_v1.xsd)
=======================================

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://schemas.google.com/schemas/pr/1.0" xmlns:pr="http://schemas.google.com/schemas/pr/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified
<span style="white-space:pre <xs:import schemaLocation="product_reviews_v1.xsd"/>
<span style="white-space:pre <xs:element name="content_format
<span style="white-space:pre <xs:complexType>
<span style="white-space:pre <xs:attribute name="type" type="pr:contentFormatType" use="required"/>
<span style="white-space:pre </xs:complexType>
<span style="white-space:pre </xs:element>
<span style="white-space:pre <xs:element name="custom
<span style="white-space:pre <xs:complexType>
<span style="white-space:pre <xs:sequence>
<span style="white-space:pre <xs:element name="custom_title" type="xs:string"/>
<span style="white-space:pre <xs:element name="custom_description" type="xs:string"/>
<span style="white-space:pre </xs:sequence>
<span style="white-space:pre </xs:complexType>
<span style="white-space:pre </xs:element>
<span style="white-space:pre <xs:element name="role" type="xs:string"/>
<span style="white-space:pre <xs:element name="number_of_reviews" type="xs:integer"/>
<span style="white-space:pre <xs:element name="average_rating" type="pr:ratingType"/>
<span style="white-space:pre <xs:element name="author_rating" type="pr:ratingType"/>
<span style="white-space:pre <xs:complexType name="ratingType
<span style="white-space:pre <xs:sequence>
<span style="white-space:pre <xs:element name="attr" type="pr:attrType" maxOccurs="unbounded"/>
<span style="white-space:pre </xs:sequence>
<span style="white-space:pre </xs:complexType>
<span style="white-space:pre <xs:element name="pros" type="xs:string"/>
<span style="white-space:pre <xs:element name="cons" type="xs:string"/>
<span style="white-space:pre <xs:element name="overview" type="xs:string"/>
<span style="white-space:pre <xs:element name="ratings" type="pr:ratingType"/>
<span style="white-space:pre <xs:element name="awards
<span style="white-space:pre <xs:complexType>
<span style="white-space:pre <xs:sequence>
<span style="white-space:pre <xs:element name="award" type="pr:awardType" maxOccurs="unbounded"/>
<span style="white-space:pre </xs:sequence>
<span style="white-space:pre </xs:complexType>
<span style="white-space:pre </xs:element>
<span style="white-space:pre <xs:complexType name="awardType
<span style="white-space:pre <xs:sequence>
<span style="white-space:pre <xs:element name="award_name" type="xs:string"/>
<span style="white-space:pre <xs:element ref="link" minOccurs="0"/>
<span style="white-space:pre </xs:sequence>
<span style="white-space:pre </xs:complexType>
<span style="white-space:pre <xs:complexType name="attrType
<span style="white-space:pre <xs:attribute name="name" type="xs:string" use="required"/>
<span style="white-space:pre <xs:attribute name="max" type="xs:integer" use="optional"/>
<span style="white-space:pre <xs:attribute name="min" type="xs:integer" use="optional"/>
<span style="white-space:pre <xs:attribute name="value" type="xs:float" use="optional"/>
<span style="white-space:pre </xs:complexType>
<span style="white-space:pre <xs:element name="products
<span style="white-space:pre <xs:complexType>
<span style="white-space:pre <xs:sequence>
<span style="white-space:pre <xs:element name="product" type="pr:productType" maxOccurs="unbounded"/>
<span style="white-space:pre </xs:sequence>
<span style="white-space:pre </xs:complexType>
<span style="white-space:pre </xs:element>
<span style="white-space:pre <xs:element name="related_products
<span style="white-space:pre <xs:complexType>
<span style="white-space:pre <xs:sequence>
<span style="white-space:pre <xs:element name="related_product" type="pr:relatedProductType" maxOccurs="unbounded"/>
<span style="white-space:pre </xs:sequence>
<span style="white-space:pre </xs:complexType>
<span style="white-space:pre </xs:element>
<span style="white-space:pre <xs:complexType name="productType
<span style="white-space:pre <xs:sequence>
<span style="white-space:pre <xs:element name="product_id" type="pr:productIDType" minOccurs="0" maxOccurs="unbounded"/>
<span style="white-space:pre <xs:element name="brand" type="xs:string" minOccurs="0"/>
<span style="white-space:pre <xs:element name="product_name" type="xs:string"/>
<span style="white-space:pre <xs:element name="product_category" type="pr:productCategoryType" minOccurs="0" maxOccurs="unbounded"/>
<span style="white-space:pre <xs:element ref="link" minOccurs="0" maxOccurs="unbounded"/>
<span style="white-space:pre <xs:element name="number_of_reviews" type="xs:integer" minOccurs="0"/>
<span style="white-space:pre <xs:element name="average_rating" type="pr:ratingType" minOccurs="0"/>
<span style="white-space:pre </xs:sequence>
<span style="white-space:pre </xs:complexType>
<span style="white-space:pre <xs:complexType name="relatedProductType
<span style="white-space:pre <xs:sequence>
<span style="white-space:pre <xs:element name="product_id" type="pr:productIDType" minOccurs="0" maxOccurs="unbounded"/>
<span style="white-space:pre <xs:element name="brand" type="xs:string" minOccurs="0"/>
<span style="white-space:pre <xs:element name="product_name" type="xs:string"/>
<span style="white-space:pre <xs:element name="product_category" type="pr:productCategoryType" minOccurs="0" maxOccurs="unbounded"/>
<span style="white-space:pre <xs:element ref="link" minOccurs="0" maxOccurs="unbounded"/>
<span style="white-space:pre </xs:sequence>
<span style="white-space:pre <xs:attribute name="relate" type="pr:relatedProductRelationType" use="required"/>
<span style="white-space:pre </xs:complexType>
<span style="white-space:pre <xs:complexType name="productIDType" mixed="true
<span style="white-space:pre <xs:attribute name="contenttype" type="pr:productIDTypeType" use="required"/>
<span style="white-space:pre </xs:complexType>
<span style="white-space:pre <xs:complexType name="productCategoryType" mixed="true
<span style="white-space:pre <xs:attribute name="level" type="xs:integer" use="required"/>
<span style="white-space:pre <xs:attribute name="category_id" type="xs:integer" use="optional"/>
<span style="white-space:pre </xs:complexType>
<span style="white-space:pre <xs:simpleType name="contentFormatType
<span style="white-space:pre <xs:restriction base="xs:string
<span style="white-space:pre <xs:enumeration value="buying_guide"/>
<span style="white-space:pre <xs:enumeration value="editorial_review"/>
<span style="white-space:pre <xs:enumeration value="user_review"/>
<span style="white-space:pre </xs:restriction>
<span style="white-space:pre </xs:simpleType>
<span style="white-space:pre <xs:simpleType name="productIDTypeType
<span style="white-space:pre <xs:restriction base="xs:string
<span style="white-space:pre <xs:enumeration value="EAN"/>
<span style="white-space:pre <xs:enumeration value="ISBN"/>
<span style="white-space:pre <xs:enumeration value="MPN"/>
<span style="white-space:pre <xs:enumeration value="UPC"/>
<span style="white-space:pre <xs:enumeration value="base_docid"/>
<span style="white-space:pre </xs:restriction>
<span style="white-space:pre </xs:simpleType>
<span style="white-space:pre <xs:simpleType name="relatedProductRelationType
<span style="white-space:pre <xs:restriction base="xs:string
<span style="white-space:pre <xs:enumeration value="complementary"/>
<span style="white-space:pre <xs:enumeration value="substitute"/>
<span style="white-space:pre </xs:restriction>
<span style="white-space:pre </xs:simpleType>
</xs:schema>

<br/>

<br/>

Please note:
====================
both these schemas were extracted from the below sample xml doc
============================================

<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns:atom="http://www.w3.org/2005/Atom" xml:lang="en-US" xmlns:pr="http://schemas.google.com/schemas/pr/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://google.com/products/product_reviews_v1.xsd
<span style="white-space:pre <author>
<span style="white-space:pre <name>Review Source</name>
<span style="white-space:pre <email>contact@example.com</email>
<span style="white-space:pre </author>
....rest of xml fragment

<br/>

My plan was to use xsd tool to create an object in which to load the xml and validate it. If I cant get the object created Im in for a lot of typing/xslt transformation.
<br/>

Thanks for your help

View the full article
 

Similar threads

A
Replies
0
Views
162
ANIL AYDINALP
A
R
Replies
0
Views
111
Rehan Mubarak
R
B
Replies
0
Views
131
billybobsonic
B
Back
Top