Hello Yali,
Are you looking for a one-time process (or something done "once in a while"), or a fully automated solution?
I think you will have more options if you are willing to have a manual step in the process.
For example, if you are able to extract your data in CSV (using either the XML ID or the NAACCR numbers as column headers), then there are software you can use to convert CSV to XML (File*Pro is one of them, there might be others).
If you are looking for a fully automated solution, I recommend you look into existing libraries to help you with that. I am not personally familiar with it, but I know that at some point CDC released a DLL to read/write XML. It was part of their XML Exchange Plus software (https://www.cdc.gov/cancer/npcr/tools/registryplus/xml-exchange-plus.htm). I took a quick look and I don't see a reference to a standalone DLL anymore, but it might be worth for you to contact them and ask about it. It might still be available somewhere else.
You can also write the code yourself to convert CSV to XML, but that will certainly take more time than using an existing library!
------------------------------
Fabian Depry
Information Management Services, Inc.
------------------------------
Original Message:
Sent: 09-28-2021 22:20
From: Yali Yang
Subject: Any C# sample code to write out the patient and tumor records in SQL Server database to a version 21 XML file?
Hello;
We use SQL Server database to store patient and tumor information for our provincial cancer data(Canadian Cancer Registry). We would like to write out the data in the database to NAACCR XML (version 21) directly using C# libraries. Has anyone here done the similar work?
Thanks,
Yali
------------------------------
Yali Yang
[CompanyName]
------------------------------