Stream: dotnet
Topic: Different Validation options
Jefferson (Aug 28 2019 at 17:18):
When you validate FHIR message do you use FhirXmlParser vs the SerializationUtil.XmlReaderFromXmlText? I get different results base on what I am using?
var HL7obj = new FhirXmlParser().Parse<PlanDefinition>(HL7FileData);
or
var reader = SerializationUtil.XmlReaderFromXmlText(HL7FileData);
Michel Rutten (Aug 29 2019 at 08:52):
You should always use the specialized FHIR XML/JSON deserializer classes in the .NET FHIR library.
Jefferson (Aug 29 2019 at 11:58):
@Michel Rutten you mean the SerializationUtil class?
Michel Rutten (Aug 29 2019 at 12:19):
Parse to ISourceNode
(new):
FhirXmlNode.Parse(xml); FhirJsonNode.Parse(json);
Returns an ISourceNode
instance.
You can call ToPoco()
on the result to convert to a strongly typed class
Parse to PoCo (classic):
new FhirXmlParser().Parse<Patient>(xml); new FhirJsonParser().Parse<Patient>(json);
Returns a FHIR PoCo instance, in this example a Patient
class.
Jefferson (Aug 29 2019 at 15:38):
For the FhirXmlParser, will it call the .Net XSD validator I have the EnableXsdValidation = true and it will not validate xhtml.
Michel Rutten (Aug 29 2019 at 15:38):
@Ewout?
Ward Weistra (Aug 30 2019 at 09:16):
@Ewout Kramer
Ewout Kramer (Sep 02 2019 at 08:24):
This bit in the documentation describes the different approaches: http://docs.simplifier.net/fhirnetapi/parsing.html
Let me know if you're missing something!
Last updated: Apr 12 2022 at 19:14 UTC