fix problems with skipping unknown content, and empty differentials
This commit is contained in:
parent
8cecfcb06a
commit
909535eea2
|
@ -295,9 +295,19 @@ public abstract class XmlParserBase extends ParserBase implements IParser {
|
|||
}
|
||||
|
||||
|
||||
protected void unknownContent(XmlPullParser xpp) throws FHIRFormatError {
|
||||
protected void unknownContent(XmlPullParser xpp) throws FHIRFormatError, XmlPullParserException, IOException {
|
||||
if (!isAllowUnknownContent())
|
||||
throw new FHIRFormatError("Unknown Content "+xpp.getName()+" @ "+pathForLocation(xpp));
|
||||
// otherwise, read over whatever element this is
|
||||
int count = 1;
|
||||
do {
|
||||
xpp.next();
|
||||
if (xpp.getEventType() == XmlPullParser.END_TAG)
|
||||
count--;
|
||||
if (xpp.getEventType() == XmlPullParser.START_TAG)
|
||||
count++;
|
||||
} while (count > 0);
|
||||
xpp.next();
|
||||
}
|
||||
|
||||
protected XhtmlNode parseXhtml(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
|
||||
|
|
|
@ -2494,8 +2494,11 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
List<ElementDefinition> list = diff ? profile.getDifferential().getElement() : profile.getSnapshot().getElement();
|
||||
List<StructureDefinition> profiles = new ArrayList<StructureDefinition>();
|
||||
profiles.add(profile);
|
||||
if (list.isEmpty())
|
||||
throw new FHIRException((diff ? "Differential" : "Snapshot") + " is empty generating hierarchical table for "+profile.getUrl());
|
||||
if (list.isEmpty()) {
|
||||
ElementDefinition root = new ElementDefinition().setPath(profile.getType());
|
||||
root.setId(profile.getType());
|
||||
list.add(root);
|
||||
}
|
||||
genElement(defFile == null ? null : defFile+"#", gen, model.getRows(), list.get(0), list, profiles, diff, profileBaseFileName, null, snapshot, corePath, imagePath, true, logicalModel, profile.getDerivation() == TypeDerivationRule.CONSTRAINT && usesMustSupport(list), allInvariants, null);
|
||||
try {
|
||||
return gen.generate(model, imagePath, 0, outputTracker);
|
||||
|
|
|
@ -99,14 +99,18 @@ public class ProfileValidator extends BaseValidator {
|
|||
}
|
||||
}
|
||||
}
|
||||
for (ElementDefinition diffElement : profile.getDifferential().getElement()) {
|
||||
ElementDefinition snapElement = snapshotElements.get(diffElement.getId());
|
||||
if (snapElement!=null) { // Happens with profiles in the main build - should be able to fix once snapshot generation is fixed - Lloyd
|
||||
warning(errors, IssueType.BUSINESSRULE, diffElement.getId(), !checkMustSupport || snapElement.hasMustSupport(), "Elements included in the differential should declare mustSupport");
|
||||
if (checkAggregation) {
|
||||
for (TypeRefComponent type : snapElement.getType()) {
|
||||
if ("http://hl7.org/fhir/Reference".equals(type.getCode()) || "http://hl7.org/fhir/canonical".equals(type.getCode())) {
|
||||
warning(errors, IssueType.BUSINESSRULE, diffElement.getId(), type.hasAggregation(), "Elements with type Reference or canonical should declare aggregation");
|
||||
if (snapshotElements != null) {
|
||||
for (ElementDefinition diffElement : profile.getDifferential().getElement()) {
|
||||
if (diffElement == null)
|
||||
throw new Error("What?");
|
||||
ElementDefinition snapElement = snapshotElements.get(diffElement.getId());
|
||||
if (snapElement!=null) { // Happens with profiles in the main build - should be able to fix once snapshot generation is fixed - Lloyd
|
||||
warning(errors, IssueType.BUSINESSRULE, diffElement.getId(), !checkMustSupport || snapElement.hasMustSupport(), "Elements included in the differential should declare mustSupport");
|
||||
if (checkAggregation) {
|
||||
for (TypeRefComponent type : snapElement.getType()) {
|
||||
if ("http://hl7.org/fhir/Reference".equals(type.getCode()) || "http://hl7.org/fhir/canonical".equals(type.getCode())) {
|
||||
warning(errors, IssueType.BUSINESSRULE, diffElement.getId(), type.hasAggregation(), "Elements with type Reference or canonical should declare aggregation");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue