Creating Classes from XSD

Kmcnet 1,066 Reputation points
2023-04-08T16:10:22.04+00:00

Hello everyone and thanks for the help in advance. I have been assigned a project tat ultimately creates XML files to be uploaded to a third party api. The data will be stored in a SQL server database before being transformed into the XML files. I was provided a few sample XML files along with several XSD files. I have no experience working with these types of files and how they interconnect with the creation of C# Visual Studio projects. I've read a little about creating C# classes from XSD files, but haven't been able to successfully do so. So I really need some insight and help as to how to proceed. Any help would be appreciated.

Developer technologies Visual Studio Other
Developer technologies C#
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2023-04-08T18:52:28.8366667+00:00

    .net support for xml & xsd is waning. most is around the xsd tool.

    https://learn.microsoft.com/en-us/dotnet/standard/serialization/xml-schema-def-tool-gen

    and the serialization libraries.

    https://learn.microsoft.com/en-us/dotnet/standard/serialization/xml-and-soap-serialization.

    you use the xsd tool to create classes the xml can serialize to and from. you add this classes to you project. I often make a separate project for these files. you than can use them as the target type for serialization.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.