For some reason, the MS.Net tool (v3.5) - xsd.exe does not generate types if they are not used inside any element.
eg.
XSD file (I selected a complex element to avoid this warning - βWarning: classes cannot be created because top-level elements with a complex type were not found.β):
<?xml version="1.0" encoding="utf-8"?> <xs:schema targetNamespace="http://tempuri.org/XMLSchema.xsd" elementFormDefault="qualified" xmlns="http://tempuri.org/XMLSchema.xsd" xmlns:mstns="http://tempuri.org/XMLSchema.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" > <xs:simpleType name="EnumTest"> <xs:restriction base="xs:string"> <xs:enumeration value="item1" /> <xs:enumeration value="item2" /> <xs:enumeration value="item3" /> </xs:restriction> </xs:simpleType> <xs:complexType name="myComplexType"> <xs:attribute name="Name" use="required" type="xs:string"/> </xs:complexType> <xs:element name="myElem" type="myComplexType"></xs:element> </xs:schema>
When I run this through xsd.exe using
xsd / c xsdfile.xsd
I do not see EnumTest in the generated cs file.
Note; Despite the fact that I do not use the enumeration here, but in my actual project, I have such cases when we send the value of the enumeration string as output.
How to make the xsd tool enable them? Or do I need to switch to another tool?
I work in Visual Studio 2008.
Mrchief
source share