0

I have two xsds that both import the same generic xsd. I can generate classes for both the xsds that contain the generic xsd using xsd.exe (I have to use different namespaces as the fields are the same in a lot of cases where the xsds import the generic xsd).

I want to know whether its possible to generate a class for the generic xsd and then have the two other xsds inherit from that? This way I can transfer data over without having to write horrendous conversion methods.

Thanks in advance

  • Create a Base class then have two classes that inherit the base class. – jdweng Feb 22 '19 at 12:28
  • I'm not sure that would work as if there's a change to any of the xsds I need to run xsd.exe which overwrites the file. From a maintenance perspective this isn't ideal as I would have to then edit the generated classes each time. – Richard Hudson Feb 22 '19 at 12:37
  • Well that is a problem when you are using recursive schema with the Net Serialization. Something has to be custom. – jdweng Feb 22 '19 at 13:33
  • I suspect the issue is perhaps that xsd.exe is probably a bit too crude for what I'm looking to do. Have you heard of any other tools that could achieve this? – Richard Hudson Feb 22 '19 at 15:26
  • I don't think any tool will give recursive classes. The schema defines types and can have child that is the same type as the parent. The serialization library in Net doesn't handle the recursion. How does the schema tool know if you have 5 or 10 layers of recursion? – jdweng Feb 22 '19 at 15:30

1 Answers1

1

Found the answer from Tool that can combine many XSD files into one?

Created another file which listed the schemas and the generated them by using the /p command in xsd.exe