dcarbone/php-fhir

Add xmlns="http://hl7.org/fhir" upon XML serialization

dennisverspuij opened this issue · 3 comments

I would like that conform FHIR spec any XML serialization contains an xmlns="http://hl7.org/fhir", at least at the outer element.
But it seems xmlSerialize() only adds an xmlns when manually set through method _getFHIRXMLNamespace(), or if it was unserialized from XML that contained such xmlns. But not upon construction of objects or unserializing from json.
Why was it chosen not to set this default namespace, the constant PHPFHIR_FHIR_XMLNS is never used while generating classes?
How can I best ensure serialized XML always contains xmlns="http://hl7.org/fhir" at the outer element?
Thanks.

This is a known issue right now :(

I am working on a bigger update to supporting only PHP 8.1+, will be adding this to the list of features I want to enable!

Same underlying issue as #63

@dennisverspuij I've released v3.0.0, can you please check if it addresses this issue?