One XSD, two code generation tools, two namespaces

前端 未结 2 1746
甜味超标
甜味超标 2021-01-26 03:00

I have a XSD file, from which I want to generate C# and Java classes as well.

I first set the namespace in the XSD according to my C# namespace where my classes resides.

相关标签:
2条回答
  • 2021-01-26 03:39

    The XSD namespace doesn't have to match the package structure, at least not in Java. When generating the classes using JAXB just provide the package you want to put the classes into.

    0 讨论(0)
  • 2021-01-26 03:50

    You must take your pick as to what model is the main one: XSD, C#, or Java code. Once you make that choice, you must let the other two vary as they may. The best choice would be to make your XSD the reference model, generate the code in both languages with their respective tools, and just accept the results.

    You can also try to pick the XML namespace such that the code at both ends will be satisfactory, but don't try to force anything to the last letter. That's not how it's meant to work.

    0 讨论(0)
提交回复
热议问题