如何将 XSD 架构与导入和包含合并到一个文件中? [英] How could I merge an XSD schema with imports and includes into a single file?
问题描述
我是一个包含多个导入和包含的 xsd 文件.
I an xsd file with multiple imports and includes.
我需要基本上将架构合并到一个文件中,以便在第三方应用程序(不支持包含)中使用.
I need to basically merge the schema into a single file for use in a third-party application (which does not support includes).
是否有免费/开源工具或脚本可以做到这一点?
Is there a free/opensource tool or script that can do this?
推荐答案
你可能会发现在 SO 上被问过几次的同样有用,例如 此处 和此处.另一个免费资源可能是 Microsoft 的 Technet,因为它与 MS SQL Server 产品中存在的限制有关(还显示了与您的问题相关的真实示例),其中不支持
You may find helpful the same that was asked on SO a couple of times, for example here and here. Another free source might be the one described on Microsoft's Technet, as it relates to limitations present in MS SQL Server products (also showing a real life example related to your question), where <xsd:include/>s are not supported. If you don't have the ability to compile and run that code, you can still use it as a "script" with little help from a C# script engine such as this.
然而,正如我所指出的 此处,考虑到模式文件只能针对一个命名空间的限制,无法将 <xsd:import/> 重构为out".
However, as I've pointed out here, the <xsd:import/>s cannot be refactored "out" given the limitation where a schema file can only target one namespace.
如果您遇到过非常严重的重构场景,例如 此处所述,你可能得考虑别的……
If you're ever into a really serious refactoring scenario such as the one described here, you may have to consider something else...
这篇关于如何将 XSD 架构与导入和包含合并到一个文件中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!