使用 XSD.exe 生成 C# 帮助程序类:处理导入架构失败
我想从 KML2.2 xml 架构 使用 XSD.exe 工具(来自 VS2008 SDK)。 对于 KML2.1,该工具运行得很好。 但是,KML2.2 架构包含指向其他架构的导入标记导致 XSD.exe 崩溃。
这是我收到的错误消息:
C:\Program Files\Microsoft Visual Studio 2008 SDK\VisualStudioIntegration\Sample
s\Sdm> xsd.exe d:\temp\kml22.xsd /c /l:CS /n:Google.Kml22 /o:D:\temp\
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.w3.org/2005/Atom:author' element is
not declared. Line 311, position 12.
Schema validation warning: The 'http://www.w3.org/2005/Atom:link' element is not
declared. Line 312, position 12.
Schema validation warning: The 'urn:oasis:names:tc:ciq:xsdschema:xAL:2.0:Address
Details' element is not declared. Line 314, position 12.
Warning: Schema could not be validated. Class generation may fail or may produce
incorrect results.
Error: Error generating classes for schema 'd:\temp\kml22'.
- The element 'http://www.w3.org/2005/Atom:author' is missing.
Do you have suggest how Could I generated my C# helper files?
I would like to produce C# helper files from the KML2.2 xml schema using the XSD.exe tool (from VS2008 SDK). With KML2.1, the tool worked just fine. However, the KML2.2 schema contains import tags pointing to other schemas causing XSD.exe to freak out.
This is the error message I get:
C:\Program Files\Microsoft Visual Studio 2008 SDK\VisualStudioIntegration\Sample
s\Sdm> xsd.exe d:\temp\kml22.xsd /c /l:CS /n:Google.Kml22 /o:D:\temp\
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.w3.org/2005/Atom:author' element is
not declared. Line 311, position 12.
Schema validation warning: The 'http://www.w3.org/2005/Atom:link' element is not
declared. Line 312, position 12.
Schema validation warning: The 'urn:oasis:names:tc:ciq:xsdschema:xAL:2.0:Address
Details' element is not declared. Line 314, position 12.
Warning: Schema could not be validated. Class generation may fail or may produce
incorrect results.
Error: Error generating classes for schema 'd:\temp\kml22'.
- The element 'http://www.w3.org/2005/Atom:author' is missing.
Do you have suggestions how could I generate my C# helper files?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您必须在命令行中指定所有涉及的 XSD,包括导入。 这里一篇博客文章一个例子。
You have to specify all of the XSDs involved, including imports, in the command line. Here's a blog post with an example.
我写了一个快速的 LinqPad 脚本来让 XSD.EXE 执行我的命令。将其复制/粘贴到 LinqPad 中,更改第三行以指向您的 XSD,按 F5,然后 TADA!
欲了解更多相关信息,请访问 http://www .alexdresko.com/2015/10/08/xsd-exe-and-imports-a-solution/
I wrote a quick LinqPad script to make XSD.EXE do my bidding.. Copy/paste this into LinqPad, change the 3rd line to point to your XSD, press F5, and TADA!
Read more about it at http://www.alexdresko.com/2015/10/08/xsd-exe-and-imports-a-solution/