Merge pull request #1584 from ahdis/oe_cda1583
#1583 do not serialize choice group
This commit is contained in:
commit
979440f926
|
@ -889,13 +889,15 @@ public class XmlParser extends ParserBase {
|
|||
xml.attribute(child.getProperty().getXmlNamespace(),child.getProperty().getXmlName(), av);
|
||||
}
|
||||
}
|
||||
if (linkResolver != null)
|
||||
xml.link(linkResolver.resolveProperty(element.getProperty()));
|
||||
if (!xml.namespaceDefined(element.getProperty().getXmlNamespace())) {
|
||||
String abbrev = makeNamespaceAbbrev(element.getProperty(), xml);
|
||||
xml.namespace(element.getProperty().getXmlNamespace(), abbrev);
|
||||
if (!element.getProperty().getDefinition().hasExtension(ToolingExtensions.EXT_ID_CHOICE_GROUP)) {
|
||||
if (linkResolver != null)
|
||||
xml.link(linkResolver.resolveProperty(element.getProperty()));
|
||||
if (!xml.namespaceDefined(element.getProperty().getXmlNamespace())) {
|
||||
String abbrev = makeNamespaceAbbrev(element.getProperty(), xml);
|
||||
xml.namespace(element.getProperty().getXmlNamespace(), abbrev);
|
||||
}
|
||||
xml.enter(element.getProperty().getXmlNamespace(), elementName);
|
||||
}
|
||||
xml.enter(element.getProperty().getXmlNamespace(), elementName);
|
||||
|
||||
if (!root && element.getSpecial() != null) {
|
||||
if (linkResolver != null)
|
||||
|
@ -919,9 +921,11 @@ public class XmlParser extends ParserBase {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!root && element.getSpecial() != null)
|
||||
xml.exit(element.getProperty().getXmlNamespace(),element.getType());
|
||||
xml.exit(element.getProperty().getXmlNamespace(),elementName);
|
||||
if (!element.getProperty().getDefinition().hasExtension(ToolingExtensions.EXT_ID_CHOICE_GROUP)) {
|
||||
if (!root && element.getSpecial() != null)
|
||||
xml.exit(element.getProperty().getXmlNamespace(),element.getType());
|
||||
xml.exit(element.getProperty().getXmlNamespace(),elementName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package org.hl7.fhir.r5.test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
|
@ -26,10 +28,10 @@ public class CDARoundTripTests {
|
|||
@BeforeAll
|
||||
public static void setUp() throws Exception {
|
||||
FilesystemPackageCacheManager pcm = new FilesystemPackageCacheManager.Builder().build();
|
||||
context = new SimpleWorkerContext(TestingUtilities.getWorkerContext(pcm.loadPackage("hl7.fhir.r4.core", "4.0.1")));
|
||||
context = new SimpleWorkerContext(TestingUtilities.getWorkerContext(pcm.loadPackage("hl7.fhir.r5.core", "5.0.0")));
|
||||
fp = new FHIRPathEngine(context);
|
||||
|
||||
NpmPackage npm = new FilesystemPackageCacheManager.Builder().build().loadPackage("hl7.cda.uv.core", "current");
|
||||
NpmPackage npm = new FilesystemPackageCacheManager.Builder().build().loadPackage("hl7.cda.uv.core", "2.0.0-sd");
|
||||
context.loadFromPackage(npm, null);
|
||||
}
|
||||
|
||||
|
@ -186,6 +188,7 @@ public class CDARoundTripTests {
|
|||
Assertions.assertEquals("LOINC", fp.evaluateToString(null, cdaExample, cdaExample, cdaExample, fp.parse("ClinicalDocument.code.codeSystemName")));
|
||||
Assertions.assertEquals("Episode Note", fp.evaluateToString(null, cdaExample, cdaExample, cdaExample, fp.parse("ClinicalDocument.title.xmlText")));
|
||||
Assertions.assertEquals("Episode Note", fp.evaluateToString(null, cdaExample, cdaExample, cdaExample, fp.parse("ClinicalDocument.title.ofType(CDA.ST).xmlText")));
|
||||
Assertions.assertEquals("Levin", fp.evaluateToString(null, cdaExample, cdaExample, cdaExample, fp.parse("ClinicalDocument.recordTarget.patientRole.patient.name.item.family.xmlText")));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -203,6 +206,9 @@ public class CDARoundTripTests {
|
|||
|
||||
ByteArrayOutputStream baosXml = new ByteArrayOutputStream();
|
||||
Manager.compose(context, cda, baosXml, FhirFormat.XML, OutputStyle.PRETTY, null);
|
||||
String result = baosXml.toString();
|
||||
// https://github.com/hapifhir/org.hl7.fhir.core/issues/1583
|
||||
assertEquals(-1,result.indexOf("<item>"));
|
||||
Element cdaXmlRoundtrip = Manager.parseSingle(context, new ByteArrayInputStream(baosXml.toString().getBytes()), FhirFormat.XML);
|
||||
assertsExample(cdaXmlRoundtrip);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue