If XSD.exe does not apply to the current file, then I am afraid you need to manually convert it to a class.
The xsd file is a special xml file. There are many ways to read it in C#, such as:
static void Main(string[] args)
{
XmlTextReader reader = new XmlTextReader(@"C:\Users\timony\Desktop\1.xsd");
XmlSchema myschema = XmlSchema.Read(reader, ValidationCallback);
}
static void ValidationCallback(object sender, ValidationEventArgs args)
{
if (args.Severity == XmlSeverityType.Warning)
Console.Write("WARNING: ");
else if (args.Severity == XmlSeverityType.Error)
Console.Write("ERROR: ");
Console.WriteLine(args.Message);
}
Or
var xsd = XDocument.Load(@"C:\Users\timony\Desktop\1.xsd");
var ns = xsd.Root.GetDefaultNamespace();
var prefix = xsd.Root.GetNamespaceOfPrefix("xsd");
var vehicle = xsd.Root.Element(prefix + "complexType");
var sections = vehicle.Element(prefix + "sequence")
.Elements(prefix + "element").ToList();
Then assign the value of each element to the properties of the class you created.
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.