How to serialize data to xml using element namespaces? #1985
-
I didn't find a way how to serialize data to xml using element namespaces. Is there any way to do this? Example: My used code: FhirXmlSerializer serializer = new FhirXmlSerializer(new SerializerSettings { Pretty = true }); string xmlText = serializer.SerializeToString(parsedData); In xmlText the elements are only shown without the namespace ("xmlns"), except of the root element ("Bundle") Example of original-xml-data: Data written by "serializer.SerializeToString": |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The FHIR specification mentions this on the XML format page: |
Beta Was this translation helpful? Give feedback.
The FHIR specification mentions this on the XML format page:
"FHIR elements are always in the namespace http://hl7.org/fhir. This is usually specified as the default namespace on the root element."
The SDK is implemented according to that, so it just puts the namespace on the top level element when serializing the data.