I have a main xsd built against another one containing shared types (they are in the same directory).
That's the header of the main one :
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="XMLSchema_Module.xsd"
xmlns:cs="XML_Common"
targetNamespace="XMLSchema_Module.xsd"
elementFormDefault="qualified">
<xsd:import schemaLocation="XML_Common.xsd" namespace="XML_Common"/>
That's the header of the shared types one :
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="XML_Common"
elementFormDefault="qualified">
That's the shared type enumeration I want to use in an attribute of the main schema :
<xsd:simpleType name="TypesType">
<xsd:restriction base ="xsd:token">
<xsd:enumeration value="int"/>
And here is the reference in the main one :
<xsd:attribute name="Type" type="cs:TypesType"/>
I am using xsd.exe to generate the serialization classes (integrated in the build process as a pre-build event). These xsd were built using VisualStudio.
<Exec Command=""C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\xsd.exe" XSchemas\XMLSchema_Module.xsd /c /o:SerializationClasses /n:ScenarioManager" />
I am translating the actual message I obtain :
The type XML_Common:TypesType is not declared or is not a simple type.
It seems to be an import problem but I do not know how to solve it.
My bad, it seems that xsd.exe does not resolve schema imports. From this article :