Merge pull request #107 from ahdis/oliveregger_logicalmodel_defaulttype_typeattr

logical model support for defaulttype/typeAttr
This commit is contained in:
Grahame Grieve 2019-11-19 08:38:58 +13:00 committed by GitHub
commit 68a2ee4af6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View File

@ -106,8 +106,11 @@ public class Property {
if (tail.endsWith("[x]") && elementName != null && elementName.startsWith(tail.substring(0, tail.length()-3))) {
String name = elementName.substring(tail.length()-3);
return isPrimitive(lowFirst(name)) ? lowFirst(name) : name;
} else
} else {
if (ToolingExtensions.hasExtension(ed, "http://hl7.org/fhir/StructureDefinition/elementdefinition-defaulttype"))
return ToolingExtensions.readStringExtension(ed, "http://hl7.org/fhir/StructureDefinition/elementdefinition-defaulttype");
throw new Error("logic error, gettype when types > 1, name mismatch for "+elementName+" on at "+ed.getPath());
}
} else if (ed.getType().get(0).getCode() == null) {
if (Utilities.existsInList(ed.getId(), "Element.id", "Extension.url"))
return "string";

View File

@ -309,8 +309,13 @@ public class XmlParser extends ParserBase {
if (property.getDefinition().hasRepresentation(PropertyRepresentation.TYPEATTR)) {
String xsiType = ((org.w3c.dom.Element) child).getAttributeNS(FormatUtilities.NS_XSI, "type");
if (Utilities.noString(xsiType)) {
if (ToolingExtensions.hasExtension(property.getDefinition(), "http://hl7.org/fhir/StructureDefinition/elementdefinition-defaulttype")) {
xsiType = ToolingExtensions.readStringExtension(property.getDefinition(), "http://hl7.org/fhir/StructureDefinition/elementdefinition-defaulttype");
n.setType(xsiType);
} else {
logError(line(child), col(child), path, IssueType.STRUCTURE, "No type found on '"+child.getLocalName()+'"', IssueSeverity.ERROR);
ok = false;
}
} else {
if (xsiType.contains(":"))
xsiType = xsiType.substring(xsiType.indexOf(":")+1);