开发者

XSD Namespace to C# Namespace

We are looking for a way to have C# autogenerate classes from an XSD and create C# namespaces using the namespace info in the XSD.

Doesnt seem like you can create a structured (xxxx.yyyy.zzzz) C# namespace from the XSD?

Is there a trick we're missing?

Thanks开发者_JAVA百科


Would this do the trick? the /n allows you to specify a namespace to put the generated class in.

xsd.exe /classes MyXSDInput.xsd /n:MyCsharpNamespace


There's a really interesting project XSD2Code on Codeplex. It basically does the same as xsd.exe - only better, on the command line, and as a Visual Studio plugin.

You just right-click on an XSD file in your solution explorer and run the tool!

alt text http://i3.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=Xsd2Code&DownloadId=41336

You can set any valid .NET namespace as the target namespace for your generated code files.

Update: the XSD2Code tool has been further developed and is now offered as both a free and a paid, commercial tool - see the official home page for more details.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜