“添加服务参考...”至 xsd
我可以在 Visual Studio 2010 中创建对 xsd 的服务引用。该参考下载所有链接的 xsd 文件。但是,我有两个问题想看看是否有解决方案:
每个 xsd 的 URL 实际上以 .gx 结尾(例如 http://mycompany.com/Schema1.gx)。当 Visual Studio 导入文件时,它将它们重命名为 .xsd,但在 xsd:import 节点中,它保留原始引用名称为 .gx,因此我的引用一旦进入 Visual Studio,就会“找不到或无效”
对于某些xsd:import 语句,所引用的.gx 文件的路径位于另一个目录中(例如,schemaLocation="subDirectory1/Schema1.gx")。但是,导入时,所有 xsd 文件都位于 Visual Studio 中的同一目录中,但同样,xsd:import 节点不会修改以反映更扁平的结构。
有没有办法以有效的方式导入这些 xsd?
I can create a service reference in Visual Studio 2010 to an xsd. That reference downloads all the linked xsd files. However, I have 2 problems I'd like to see if there are solutions:
The URL for each xsd actually ends in .gx (e.g., http://mycompany.com/Schema1.gx). When Visual Studio imports the files, it renames them to .xsd, but in the xsd:import node, it keeps the original reference name with .gx, so my reference, once it's in Visual Studio is "not found or invalid"
for some of the xsd:import statements, the path to the referred-to .gx file is in another directory (e.g., schemaLocation="subDirectory1/Schema1.gx"). However, when they're imported, all xsd files are in the same directory in Visual Studio, but again, the xsd:import node is not modified to reflect the flatter structure.
Is there a solution to import these xsds in a valid way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这很可能是一个错误 - svcutil 不会“重构”模式。如果您想要一个能够处理此类工作以及类似工作的工具,这个 XML 架构重构工具应该会有所帮助。下载、安装并创建新的 XML 架构重构文件 (.xsr);添加新的 XML 模式集合;右键单击版本1.0,选择[导入架构文件...]命令并按照提示操作。它可以“获取”在线模式,包括从 WSDL 文件引用或嵌入其中的模式等。
It is most likely a bug - the svcutil doesn't "refactor" the schemas. If you want a tool that handles this kind of work and more like it, this XML Schema refactoring tool should help. Download, install and create a new XML Schema Refactoring file (.xsr); add a new XML Schema collection; right click on the version 1.0, select [Import Schema Files...] command and follow the prompts. It can "slurp" online schemas, including ones referenced from, or embedded into, WSDL files, etc.