Last post Sep 30, 2019 03:06 PM by uid250511
Sep 23, 2019 03:11 PM|uid250511|LINK
For a learning curve and to ensure i'm not introducing bad habits, Im trying to find the correct procedure to get an XSD into a C# class. If you have an XSD which contains references to other XSDs and generate C# classes would you expect to change the automated
class if required? I'm asking this to determine if this is ok and if not is this an indication the class has not been created correctly.
Currently when i use the XSD supplied and an online service to generate the XML, the C# classes generated are slightly incorrect (i receive an error that the XML received is incorrect (1, 40)), so i added the odd property along with the Element it requires
and all is working again.
I tried XSD.exe but that created one huge class and i wasnt sure which the base class was or even if i took a guess i wasnt entirely sure if i was to call one URL (to get the data) then iterate through the data returned or use this data to make another call
to another URL (i.e. first call is a list of customers and the second call would then be to pass in the ID of the record to get that record's detail).
I have read some of the links posted in the past but just want to make sure im on the right track. Thanks in advance
Sep 25, 2019 06:20 AM|samwu|LINK
would you expect to change the automated class if required? I'm asking this to determine if this is ok and if not is this an indication the class has not been created correctly
You are on the right track.
But i suggest you don't modify the generated class, because It may causing program issue if you update the XSD file.
Sep 30, 2019 03:06 PM|uid250511|LINK
Thanks with the XSD residing with a 3rd party i dont believe they would change it (if they did, i would assume they would have a new URL targeting the new changes rather than changing the old service which could introduce breaking changes). In which case
if this scenario stands and if i have understood you, then this means its ok to change the class to meet the requirements as long as the XSD doesnt change?