我有一个针对另一个包含共享类型的主 xsd(它们位于同一目录中)。
这是主要的标题:
<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"/>
这是共享类型 one 的标题:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="XML_Common"
elementFormDefault="qualified">
这是我想在主模式的属性中使用的共享类型枚举:
<xsd:simpleType name="TypesType">
<xsd:restriction base ="xsd:token">
<xsd:enumeration value="int"/>
这是主要的参考:
<xsd:attribute name="Type" type="cs:TypesType"/>
我正在使用 xsd.exe 生成序列化类(作为预构建事件集成在构建过程中)。这些 xsd 是使用 VisualStudio 构建的。
<Exec Command=""C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\xsd.exe" XSchemas\XMLSchema_Module.xsd /c /o:SerializationClasses /n:ScenarioManager" />
我正在翻译我获得的实际信息:
The type XML_Common:TypesType is not declared or is not a simple type.
这似乎是一个导入问题,但我不知道如何解决它。