Using XSD.exe to generate c# classes from multiple XSD schemas
I have 2 XSD files.
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.
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">
When I am executing xsd.exe to genereate my C# classes. It is generating classes but missing some definations from XYZ.xsd.
I am executing
xsd.exe "ABC.xsd" "XYZ.xsd" /c
Any help would be appreicate
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>
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
Referencing the main XSD did not work for me.
I had to reference the dependant XSD files as per this link
http://bembengarifin.wordpress.com/2009/07/14/generate-net-class-from-xsd-with-references-to-other-xsd-using-xsd-exe/
Pass just the "main" xsd as a parameter, ensure the other is in the same location of the main, and it should work.
精彩评论