Stream: implementers
Topic: Object serialization issue
Ayaz (Feb 22 2021 at 22:18):
Dear Jean
Thanks for your prompt response and valuable advise. I am just compiling the code mention in the file
https://github.com/angusmillar/SimpleFhir/blob/master/SimplePatient/Program.cs
However, it display error message on the line
string xml = Hl7.Fhir.Serialization.FhirSerializer.SerializeResourceToXml(MyPatient);
The error message is like
" The type or namespace name 'FhirSerializer' does not exist in the namespace 'Hl7.Fhir.Serialization' (are you missing an assembly reference?) "
I installed the following libraries
- HL7.Fhir.Serialization ,
- HL7.Fhir. STU3,
- HL7.FhirPath
I don't know what's wrong in it.
I would be so thankful if you open this file and check the code. Please give me your advise.
Looking forward to hearing from you soon.
Thanks,
Ayaz
Jean Duteau (Feb 22 2021 at 23:22):
Sorry but I won't be providing any advice since I'm not a great C# developer, but at least here in this stream, hopefully someone should be able to help you.
Michele Mottini (Feb 22 2021 at 23:23):
Can you please not post the same question multiple times? There is also a #dotnet channel for question related to the .NET library and implementation.
What you need is probably
var serializer = new Hl7.Fhir.Serialization.FhirXmlSerializer();
var xml = serializer.SerializeToString( MyPatient)
Last updated: Apr 12 2022 at 19:14 UTC