为什么XSD.EXE创建两个xsd文件,以及如何使用它们? [英] Why does XSD.EXE Create Two .XSD Files, and How to Use Them?

查看:466
本文介绍了为什么XSD.EXE创建两个xsd文件,以及如何使用它们?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用下面的命令来从我的输入XML文件相关的XSD文件 - response.xml,我的困惑是:(1)为什么有两个XSD文件输出(response.xsd和response_app1.xsd),我觉得应该只有产生的其中之一? (2)如果我需要使用XSD /类,XSD文件,我应该用它来生成C#类文件?

I am using the following command to generate related xsd file from my input XML file -- response.xml, my confusion is (1) why there are two xsd file output (response.xsd and response_app1.xsd), I think there should be only one of them generated? (2) If I need to generate C# class file by using xsd /classes, which xsd file should I use?

我的环境:VSTS 2008 + C#+净3.5

My environment: 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文件,

Here is my input XML file and ouput XSD files,

<一个href="http://www.mediafire.com/file/kzzoxw0zwgq/inputoutput.zip">http://www.mediafire.com/file/kzzoxw0zwgq/inputoutput.zip

编辑1:

当我执行XSD response.xsd生成相关的C#类,也有错误信息,这里有详细的输出,

when I execute xsd response.xsd to generate related C# class, there are error messages, and here are the detailed output,

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 /?".

在此先感谢, 乔治

thanks in advance, George

推荐答案

乔治

从这些文件生成类,必须在命令行上同时列出:

To generate classes from these files, you must list both on the command line:

D:\>xsd response.xsd response_app1.xsd /classes



它已经被正确地说,这两个xsd文件是因为有你的原始XML文件中的两个XML命名空间。顺便说一句,我猜一点点这里,因为你没有张贴在XML文件中。

It has already been correctly said that the two .xsd files are because there were two XML namespaces in your original XML file. BTW, I'm guessing a little here because you did not post the XML file.

这篇关于为什么XSD.EXE创建两个xsd文件,以及如何使用它们?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆