使用XSD.exe从多个XSD架构生成c#类 [英] Using XSD.exe to generate c# classes from multiple XSD schemas

查看:69
本文介绍了使用XSD.exe从多个XSD架构生成c#类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个XSD文件.

一个XSD文件可以说ABC.xsd包含XML组成部分的元素.另一个XSD文件可以说XYZ.xsd包含这些元素的定义.

One XSD file lets say ABC.xsd contains the elements which are part of XML. The other XSD file lets say XYZ.xsd contains the definations of those elements.

现在在ABC.XSD(包含元素)模式标记以及其他名称空间中,我们也提到了模式位置

Now in ABC.XSD(which holds the elements) schema tag along with other namespaces we have mentioned the schemalocation as well

<xs:schema schemaLocation="XYZ.xsd">

当我执行xsd.exe生成C#类时.它正在生成类,但是缺少XYZ.xsd的一些定义.

When I am executing xsd.exe to genereate my C# classes. It is generating classes but missing some definations from XYZ.xsd.

我正在执行

xsd.exe "ABC.xsd" "XYZ.xsd" /c

任何帮助都将是有益的

@Felice,在我的XYZ.xsd中,我有这样的定义

EDIT 1: @Felice, in my XYZ.xsd I have defination like this

<xs:simpleType name="contactNumberType">
        <xs:annotation>
            <xs:documentation>Contact phone or fax number with national or international format.  Only numbers are allowed</xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
            <xs:pattern value="\+?\p{N}{6,24}"/>
        </xs:restriction>
    </xs:simpleType>

请参见此处定义的模式,该模式未出现在C#类中.任何帮助.对不起,我是新来的.谢谢你的回答有用

See the pattern defined here, it is not appearing in the C# class. Any help. Sorry I am new to this . Thanks your answer worked

推荐答案

仅将"main" xsd作为参数传递,确保另一个位于main的相同位置,并且应该可以使用.

Pass just the "main" xsd as a parameter, ensure the other is in the same location of the main, and it should work.

这篇关于使用XSD.exe从多个XSD架构生成c#类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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