fix CDA parsing error for sdtc:raceCode

This commit is contained in:
Grahame Grieve 2023-10-04 18:37:16 +03:00
parent 54dcbe8a9f
commit c11e78d468
3 changed files with 14 additions and 8 deletions

View File

@ -422,7 +422,11 @@ public class XmlParser extends ParserBase {
element.getChildren().add(n);
} else {
String npath = path+"/"+pathPrefix(child.getNamespaceURI())+child.getLocalName();
Element n = new Element(child.getLocalName(), property).markLocation(line(child, false), col(child, false)).setFormat(FhirFormat.XML);
String name = child.getLocalName();
if (!property.isChoice() && !name.equals(property.getName())) {
name = property.getName();
}
Element n = new Element(name, property).markLocation(line(child, false), col(child, false)).setFormat(FhirFormat.XML);
if (property.isList()) {
n.setPath(element.getPath()+"."+property.getName()+"["+repeatCount+"]");
} else {

View File

@ -249,7 +249,7 @@ Validation_VAL_Profile_MultipleMatches_other = Found multiple matching profiles
Validation_VAL_Profile_NoDefinition = No definition found for resource type ''{0}''
Validation_VAL_Profile_NoMatch = Unable to find a match for the specified profile among choices: {0}
Validation_VAL_Profile_NoSnapshot = StructureDefinition {0} has no snapshot - validation is against the snapshot, so it must be provided
Validation_VAL_Profile_NoType = The type of element {0} is not known, which is invalid. Valid types at this point are {1}
Validation_VAL_Profile_NoType = The type of element {0} is not known - it couild not be determined from the information available. Valid types at this point are {1}
Validation_VAL_Profile_NotAllowed = This element is not allowed by the profile {0}
Validation_VAL_Profile_NotSlice = This element does not match any known slice {0} and slicing is CLOSED: {1}
Validation_VAL_Profile_OutOfOrder = As specified by profile {0}, Element ''{1}'' is out of order (found after {2})

View File

@ -6215,12 +6215,13 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
if (ed.getRepresentation().isEmpty()) { // ignore xml attributes
int count = 0;
List<ElementDefinition> slices = null;
if (ed.hasSlicing())
if (ed.hasSlicing()) {
slices = profileUtilities.getSliceList(profile, ed);
for (ElementInfo ei : children)
if (ei.definition == ed)
}
for (ElementInfo ei : children) {
if (ei.definition == ed) {
count++;
else if (slices != null) {
} else if (slices != null) {
for (ElementDefinition sed : slices) {
if (ei.definition == sed) {
count++;
@ -6228,6 +6229,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
}
}
}
}
if (ed.getMin() > 0) {
if (problematicPaths.contains(ed.getPath()))
hintPlural(errors, NO_RULE_DATE, IssueType.NOTSUPPORTED, element.line(), element.col(), stack.getLiteralPath(), count >= ed.getMin(), count, I18nConstants.VALIDATION_VAL_PROFILE_NOCHECKMIN, profile.getVersionedUrl(), ed.getPath(), ed.getId(), ed.getSliceName(),ed.getLabel(), stack.getLiteralPath(), Integer.toString(ed.getMin()));
@ -6238,9 +6240,9 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
}
}
if (ed.hasMax() && !ed.getMax().equals("*")) {
if (problematicPaths.contains(ed.getPath()))
if (problematicPaths.contains(ed.getPath())) {
hintPlural(errors, NO_RULE_DATE, IssueType.NOTSUPPORTED, element.line(), element.col(), stack.getLiteralPath(), count <= Integer.parseInt(ed.getMax()), count, I18nConstants.VALIDATION_VAL_PROFILE_NOCHECKMAX, profile.getVersionedUrl(), ed.getPath(), ed.getId(), ed.getSliceName(),ed.getLabel(), stack.getLiteralPath(), ed.getMax());
else if (count > Integer.parseInt(ed.getMax())) {
} else if (count > Integer.parseInt(ed.getMax())) {
ok = rulePlural(errors, NO_RULE_DATE, IssueType.STRUCTURE, element.line(), element.col(), stack.getLiteralPath(), false, count, I18nConstants.VALIDATION_VAL_PROFILE_MAXIMUM, profile.getVersionedUrl(), ed.getPath(), ed.getId(), ed.getSliceName(),ed.getLabel(), stack.getLiteralPath(), ed.getMax(), Integer.toString(count)) && ok;
}
}