【发布时间】:2009-07-05 13:33:46
【问题描述】:
我正在使用以下命令从我的输入 XML 文件中生成相关的 xsd 文件——response.xml,我的困惑是(1)为什么有两个 xsd 文件输出(response.xsd 和 response_app1.xsd),我想应该只生成其中一个? (2) 如果我需要使用 xsd /classes 生成 C# 类文件,我应该使用哪个 xsd 文件?
我的环境:VSTS 2008 + C# + .Net 3.5。
D:\>xsd response.xml
Microsoft (R) Xml Schemas/DataTypes support utility
[Microsoft (R) .NET Framework, Version 2.0.50727.3038]
Copyright (C) Microsoft Corporation. All rights reserved.
Writing file 'D:\response.xsd'.
这是我的输入 XML 文件和输出 XSD 文件,
http://www.mediafire.com/file/kzzoxw0zwgq/inputoutput.zip
编辑 1:
当我执行xsd response.xsd生成相关C#类时,出现错误信息,这里是详细输出,
D:\>xsd response.xsd /classes
Microsoft (R) Xml Schemas/DataTypes support utility
[Microsoft (R) .NET Framework, Version 2.0.50727.3038]
Copyright (C) Microsoft Corporation. All rights reserved.
Schema validation warning: The 'http://www.mycorp.com/Order/2009/05/mex:Items' e
lement is not declared. Line 10, position 16.
Warning: Schema could not be validated. Class generation may fail or may produce
incorrect results.
Error: Error generating classes for schema 'response'.
- The element 'http://www.mycorp.com/Order/2009/05/mex:Items' is missing.
If you would like more help, please type "xsd /?".
提前致谢, 乔治
【问题讨论】: