创建XML架构和使用Visual Studio 2010自动生成序列化类出来的 [英] Creating XML schema and auto-generate the serializable class out of it using Visual Studio 2010

查看:246
本文介绍了创建XML架构和使用Visual Studio 2010自动生成序列化类出来的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图创建一个XML架构序列化/ deserilized使用Visual Studio 2010,但看起来很复杂有一个XML文件,另一个XML schema文件,我没有得到它应该怎么做。我rememeber在Visual Studio 2005是由刚刚创建XML文件和XML设计打开它然后绘制模式,然后生成序列化代码从架构要简单得多。 。任何提示/链接,这将有助于在使用Visual Studio做同样的2010专业版

I am trying to create an XML schema to be serialized/deserilized using visual studio 2010, but it looks really complicated having an xml file and another xml schema file, I didn't get how it should be done. I rememeber in visual studio 2005 it was much simpler by just creating xml file and open it with the xml designer then draw the schema, then generate the serializable code out of the schema. Any hint/ link that would help in doing the same using Visual Studio 2010 professional.

推荐答案

让我试着回答:


  1. 打开你的VS项目。

  2. 打开你的项目的XML。

  3. 在VS,进入菜单选项卡,然后点击创建模式

  4. 保存模式文件,并添加到您的项目。

  1. open your VS project.
  2. open the XML on your project.
  3. On VS, go to the menu tab and click on create schema
  4. save the schema file and added to your project.

然后你可以创建自己的类的序列化/反序列化处理或使用XSD.EXE

Then you can create your own class for the serialize/deserialize process or use xsd.exe

我用最后一个。在我的情况,我可以发现,在\Program文件(x86)\Microsoft SDKs\Windows\v7.0A\Bin\xsd.exe工具。

I used the last one. In my case I can found the tool in the \Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\xsd.exe.

然后就可以打开CMD或Visual Studio命令窗口,然后写类似:
XSD.EXE [XSD文件] / C / L:C#/ O:[目录必须要保存.CS ]

Then you can open CMD or the Visual Studio command window and write something like: xsd.exe [THE XSD FILE] /c /l:c# /o:[DIRECTORY WHERE YOU WANT TO SAVE THE .CS]

我希望这对你的作品,或回答你的问题。 。差不多我用VS 2008和2010年同样的方法

I hope this works for you or answer your question. Pretty much I used the same approach with VS 2008 and 2010.

以下是以防万一相关主题:

XSD工具:的http:// MSDN .microsoft.com / EN-US /库/ x6c1kb0s%28V = VS.80%29.aspx

XML序列化和模式,而不XSD.EXE

从XSD

如果生成类你不用微软SDK就可以得到它:
http://www.microsoft.com/en-us/download/dlx/ThankYou.aspx?id=8279

if you don't have the Microsoft SDK you can get it from: http://www.microsoft.com/en-us/download/dlx/ThankYou.aspx?id=8279

这篇关于创建XML架构和使用Visual Studio 2010自动生成序列化类出来的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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