FHIR Chat · Different Validation options · dotnet

Stream: dotnet

Topic: Different Validation options


view this post on Zulip 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);

view this post on Zulip Michel Rutten (Aug 29 2019 at 08:52):

You should always use the specialized FHIR XML/JSON deserializer classes in the .NET FHIR library.

view this post on Zulip Jefferson (Aug 29 2019 at 11:58):

@Michel Rutten you mean the SerializationUtil class?

view this post on Zulip 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.

view this post on Zulip 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.

view this post on Zulip Michel Rutten (Aug 29 2019 at 15:38):

@Ewout?

view this post on Zulip Ward Weistra (Aug 30 2019 at 09:16):

@Ewout Kramer

view this post on Zulip 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