Generating CDA Code

Generating C# code from the CDA schemas is a little different than in my previous article about XCA implementation… With XCA, svcutil doesn’t recognize <import> and <include> so you have to specify each XSD and WSDL on the command-line of the svcutil call. However, with CDA it is the exact opposite.

I started out trying to generate code with XSD.exe using the same methodology as with the XCA schemas.. However, after removing the <import> and <include> elements from the schemas, flattening the hierarchy and specifying all the XSD files on the command-line I ended up getting a ton of errors about missing elements.

So, eventually I got around to trying to just run XSD.exe with the root XSD and using the same schema hierarchy that is packed in the normative edition of CDA… Which worked.

1) Copy infrastructure and processable directories from normative cda to a directory on your drive.

2) Open a visual studio command prompt.

3) CD to the infrastructure directory.

4) Run “xsd.exe CDA.xsd /classes /language:C#”


Leave a Reply

Your email address will not be published. Required fields are marked *