Merge remote-tracking branch 'origin/master'

This commit is contained in:
Grahame Grieve 2024-11-25 15:00:27 +11:00
commit b5015557df
2 changed files with 19 additions and 15 deletions

View File

@ -1,6 +1,6 @@
## Validator Changes ## Validator Changes
* no changes * fix NPE in validator around Extension context
## Other code changes ## Other code changes

View File

@ -2478,22 +2478,26 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
} }
if (ctxt.getType() == ExtensionContextType.ELEMENT) { if (ctxt.getType() == ExtensionContextType.ELEMENT) {
String en = ctxt.getExpression(); String en = ctxt.getExpression();
contexts.append("e:" + en);
String pu = null; String pu = null;
if (en.contains("#")) { if (en == null) {
pu = en.substring(0, en.indexOf("#")); // nothing? It's an error in the extension definition, but that's properly reported elsewhere
en = en.substring(en.indexOf("#")+1);
} else { } else {
//pu = en; contexts.append("e:" + en);
} if (en.contains("#")) {
if (Utilities.existsInList(en, "Element", "Any")) { pu = en.substring(0, en.indexOf("#"));
ok = true; en = en.substring(en.indexOf("#")+1);
} else if (en.equals("Resource") && container.isResource()) { } else {
ok = true; //pu = en;
} else if (en.equals("CanonicalResource") && containsAny(VersionUtilities.getExtendedCanonicalResourceNames(context.getVersion()), plist)) { }
ok = true; if (Utilities.existsInList(en, "Element", "Any")) {
} else if (hasElementName(plist, en) && pu == null) { ok = true;
ok = true; } else if (en.equals("Resource") && container.isResource()) {
ok = true;
} else if (en.equals("CanonicalResource") && containsAny(VersionUtilities.getExtendedCanonicalResourceNames(context.getVersion()), plist)) {
ok = true;
} else if (hasElementName(plist, en) && pu == null) {
ok = true;
}
} }
if (!ok) { if (!ok) {