工具,可以结合许多XSD文件合并成一个? [英] Tool that can combine many XSD files into one?

查看:790
本文介绍了工具,可以结合许多XSD文件合并成一个?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建XML序列化器类约65 XSD文件,而我使用微软的 XSD.EXE 来生成C#code ...

I need to create XML serializer classes for approximately 65 XSD files, for which I am using Microsoft's XSD.EXE to generate the C# code...

不过,我一直运行到窗口CMD的字符数限制的结果输出文件(其中XSD.EXE结合每个XSD包含的名称):指定的路径,文件名,或者两者都太长完全合格文件名必须少于260个字符,并且目录名必须少于248个字符。

However, I keep running into Window CMD's character limit in the resulting output file (in which XSD.EXE combines the name of every XSD included): "The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters."

为了使长话短说,我似乎可以得到所有这些验证并生成在一起的唯一方法是,如果我可以合并所有的XSD(DE-引用包括/进口,这XSD.EXE不解决的schemaLocation反正)合并为一个大的。

To make a long story short, it seems that the only way I can get all these to validate and generate together is if I can merge all the XSDs (de-referencing the includes/imports, which XSD.EXE doesn't resolve the schemaLocation anyway) into one big one.

请告诉我,存在一个工具来做到这一点...

Please tell me that there exists a tool to do this...

推荐答案

你可以做的是创建另一个名为包含它所有的架构名称,然后,关键是要与名字的最后一个模式文件fil​​e.xsd新文件\为preFIX。

What you can do is to create another new file called file.xsd containing all the schema names in it and then the trick is to name the last schema file with .\ as prefix.

<xsd xmlns='http://microsoft.com/dotnet/tools/xsd/'>
    <generateClasses language='CS' namespace='MyNamespace'>
        <schema>First.xsd</schema>
        <schema>Second.xsd</schema>
        <!-- more schema files here -->
        <schema>.\Third.xsd</schema>
    </generateClasses>
</xsd>

现在运行命令XSD.EXE /p:file.xsd /班,你会得到生成的类文件:)

Now run the command "xsd.exe /p:file.xsd /classes" and you get the class file generated :)

这篇关于工具,可以结合许多XSD文件合并成一个?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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