Stream: implementers
Topic: DSTU2 | parse Resource | DSTU2 not parsing all the input par
Kunal Dangi (Apr 22 2019 at 08:50):
Hello All,
I am trying to parserResource where I am getting an expected output for DSTU3 but the same input does not work for DSTU2.
My Code :
String input = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><Patient><identifier id=\"test\"/><name id=\"tt\"><family value=\"temp\"/></name></Patient>"; FhirContext ctx = FhirContext.forDstu2(); FhirContext ctxDstu3 = FhirContext.forDstu3(); IParser parser = ctx.newXmlParser(); IParser parserDstu3 = ctxDstu3.newXmlParser(); Patient resource = (Patient) parser.parseResource(input); org.hl7.fhir.dstu3.model.Patient resourceDstu3 = (org.hl7.fhir.dstu3.model.Patient) parserDstu3.parseResource(input); System.out.println("DSTU2 Identifier data : "+resource.getIdentifier()); System.out.println("DSTU3 Identifier data : "+resourceDstu3.getIdentifier());
OUTPUT
DSTU2 Identifier data : [IdentifierDt[null]]
DSTU3 Identifier data : [org.hl7.fhir.dstu3.model.Identifier@5609159b]
As you can see I am not doing anything different for DSTU3 but DSTU3 is returning me a list but DSTU2 returns NULL
Grahame Grieve (Apr 22 2019 at 10:19):
yes the formats changed between versions - in general, you would not expect that to work
Last updated: Apr 12 2022 at 19:14 UTC