编辑:
要回答更新后的问题,Xsd2Code 似乎并非旨在一次处理多个 .xsd 文件。
我从:
- 命令行语法
Xsd2Code.exe <XSD File> [Namespace] [Output file name] [Options]
- 快速浏览源代码(从http://xsd2code.codeplex.com/SourceControl/list/changesets下载 build 88331并查看
Trunk\Xsd2Code.Console\EntryPoint.cs
.
Pascal Cabanel 似乎在 Xsd2Code 的 CodePlex 网站上非常活跃。考虑联系他以获得明确的答案:
http: //www.codeplex.com/site/users/view/pcabanel
为了自动创建支持的 xsd2Code 类文件,您可以在解决方案资源管理器中单击 .xsd 文件,然后在“属性”窗口中,将Xsd2CodeCustomTool写入/粘贴到“自定义工具”属性中。
为了在另一个 .xsd 文件中“查看”数据类型,您可以使用include
语句。
这是一个包含数据定义的 Person.xsd 示例和 Employees.xsd include
-ing Person.xsd 并使用Person
数据类型。
- 请注意,由于Employees.xsd 已经包含Person.xsd,您只需为Employees.xsd 生成Xsd2Code。
人物.xsd
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="CommonNamespace"
xmlns="CommonNamespace"
>
<xs:complexType name="Person">
<xs:sequence>
<xs:element name="Name" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
员工.xsd
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="CommonNamespace"
xmlns="CommonNamespace"
>
<xs:include schemaLocation="Person.xsd"/>
<xs:element name="Employees">
<xs:complexType>
<xs:sequence>
<xs:element name="Employee" type="Person" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>