Your schema will be divided into two documents: one storing the default namespace information ("), and the other in the google namespace (http://base.google.com/ns/1.0
). To generate the schema (in two files), you can use the utility xsd.exe
(comes installed with the Windows SDK, or in Visual Studio). If you store the above XML content in a file called root.xml
, and execute the command below:
xsd.exe root.xml
Then the following files will be generated:
root.xsd:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:app1="http://base.google.com/ns/1.0">
<xs:import namespace="http://base.google.com/ns/1.0" schemaLocation="root_app1.xsd" />
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element name="title" type="xs:string" minOccurs="0" msdata:Ordinal="0" />
<xs:element name="description" type="xs:string" minOccurs="0" msdata:Ordinal="1" />
<xs:element name="link" type="xs:string" minOccurs="0" msdata:Ordinal="2" />
<xs:element name="item" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element ref="app1:id" minOccurs="0" />
<xs:element name="title" type="xs:string" minOccurs="0" />
<xs:element name="description" type="xs:string" minOccurs="0" />
<xs:element ref="app1:category" minOccurs="0" />
<xs:element ref="app1:product_type" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="version" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="root" />
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
root.app1.xsd:
<?xml version="1.0" standalone="yes"?>
<xs:schema targetNamespace="http://base.google.com/ns/1.0" xmlns:mstns="http://base.google.com/ns/1.0" xmlns="http://base.google.com/ns/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" attributeFormDefault="qualified" elementFormDefault="qualified" xmlns:app1="http://base.google.com/ns/1.0">
<xs:element name="id" msdata:Prefix="g" type="xs:string" />
<xs:element name="category" msdata:Prefix="g" type="xs:string" />
<xs:element name="product_type" msdata:Prefix="g" type="xs:string" />
</xs:schema>