.net Visual Studio 2010 中 xsd.exe 的替代方案

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2341869/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 13:59:17  来源:igfitidea点击:

Alternative to xsd.exe in Visual Studio 2010

.netxmlvisual-studiovisual-studio-2010xsd

提问by ashwnacharya

Looks like XSD.exe is not delivered as a part of Visual Studio 2010.

看起来 XSD.exe 不是作为 Visual Studio 2010 的一部分提供的。

what is the alternative being offered in VS2010?

VS2010 中提供的替代方案是什么?

回答by Dean

It's available from the VS 2010 command prompt. Open up the VS 2010 command prompt and type "xsd /?".

它可从 VS 2010 命令提示符处获得。打开 VS 2010 命令提示符并键入“xsd /?”。

回答by adam

Start -> All Programs -> Microsoft Visual Studio 2010 -> Visual Studio Tools -> Visual Studio Command Prompt

开始 -> 所有程序 -> Microsoft Visual Studio 2010 -> Visual Studio 工具 -> Visual Studio 命令提示符

You can use xsd.exe from here.

您可以从这里使用 xsd.exe。

回答by stormwild

C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\xsd.exe

C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\xsd.exe

回答by stormwild

XML Schema Definition Toolis available in the menu "Start":

XML Schema Definition Tool在菜单“Start”中可用:

Start-> All Programs-> Microsoft Visual Studio 2010-> Visual Studio Command Prompt(2010)

开始-> 所有程序-> Microsoft Visual Studio 2010-> Visual Studio 命令提示符(2010)

You'll see the welcome message a command line:

您将在命令行中看到欢迎消息:

Setting environment for using Microsoft Visual Studio 2010 x86 tools.

D:\Program Files\Microsoft Visual Studio 10.0\VC>

You can, for example, create an XMLscheme from the XML-file.

例如,您可以从XML文件创建XML方案。

example.xml:

示例.xml:

<?xml version="1.0" encoding="utf-8"?>
<country>
    <country_name>France</country_name>
    <population>59.7</population>
</country>

To do this, enter the following:

为此,请输入以下内容:

I:\example.xml /outputdir:D:\xml2xsd

In my system, i see the following:

在我的系统中,我看到以下内容:

...
Microsoft (R) Xml Schemas/DataTypes support utility
[Microsoft (R) .NET Framework, Version 4.0.30319.1]
Copyright (C) Microsoft Corporation. All rights reserved.
Writing file 'D:\xml2xsd\example.xsd'.

D:\Program Files\Microsoft Visual Studio 10.0\VC>

In the catalog D:\xml2xsd\came a such a scheme:

在目录中D:\xml2xsd\出现了这样一个方案:

example.xsd:

示例.xsd:

<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
  <xs:element name="country">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="country_name" type="xs:string" minOccurs="0" />
        <xs:element name="population" type="xs:string" minOccurs="0" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element ref="country" />
      </xs:choice>
    </xs:complexType>
  </xs:element>
</xs:schema>

A full list of options here - http://msdn.microsoft.com/en-us/library/x6c1kb0s.aspx

此处的完整选项列表 - http://msdn.microsoft.com/en-us/library/x6c1kb0s.aspx

As for alternatives, you can search converters for operations that allows xsd.exe:

至于替代方案,您可以搜索转换器以查找允许 xsd.exe 的操作:

  • XDR to XSD

  • XML to XSD

  • XSD to DataSet

  • XSD to Classes

  • Classes to XSD

  • XDR 转 XSD

  • XML 到 XSD

  • XSD 到数据集

  • XSD 到类

  • XSD 的类

Good luck.

祝你好运。

回答by elwyn

I believe xsd.exe is not available with Visual Studio * 2010 Express

我相信 xsd.exe 不适用于 Visual Studio * 2010 Express

回答by Dunc

I had to add this to my path:

我不得不将此添加到我的路径中:

C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\

(Start > Edit the system environment variables > Environment Variables > Edit 'Path' under 'System variables')

(开始 > 编辑系统环境变量 > 环境变量 > 在“系统变量”下编辑“路径”)

Then I could start the Visual Studio command prompt (2010) and type

然后我可以启动 Visual Studio 命令提示符(2010)并输入

xsd.exe /? 

回答by Ог?ен Шоба?и?

Generally speaking DTD is an alternative to XSD and DTD is fully supported in Visual Studio. However, DTD is a weaker language, as some things can not be expressed in it. For example, it does not support as many data types as XSD does, nor does it have assertions. Anyways, if you're not too picky about it, you can give it a try.

一般来说,DTD 是 XSD 的替代品,并且 Visual Studio 完全支持 DTD。然而,DTD 是一种较弱的语言,因为有些东西不能用它来表达。例如,它支持的数据类型没有 XSD 那么多,也没有断言。总之,如果你不是太挑剔,你可以试一试。