private boolean isImportMapValid(String scriptContent) throws SAXException {
        Object importMap;
        try {
            importMap = new JSON().parse(new JSON.StringSource(scriptContent), true);
        } catch (IllegalStateException e) {
            err("A script \u201cscript\u201d with a \u201ctype\u201d attribute"
                    + " whose value is \u201cimportmap\u201d must have valid"
                    + " JSON content.");
            return false;
        }
        if (!(importMap instanceof Map)) {
            err("A \u201cscript\u201d element with a \u201ctype\u201d attribute"
                    + " whose value is \u201cimportmap\u201d must contain a"
                    + " JSON object.");
            return false;
        }

        Map<String, Object> importMapObject = (Map<String, Object>) importMap;

        for (Map.Entry<String, Object> importMapEntry : importMapObject.entrySet()) {
            String specifierType = importMapEntry.getKey();
            if (!"imports".equals(specifierType)
                    && !"scopes".equals(specifierType)) {
                err("A \u201cscript\u201d element with a \u201ctype\u201d"
                        + " attribute whose value is \u201cimportmap\u201d must"
                        + " contain a JSON object with no properties other than"
                        + " \u201cimports\u201d and \u201cscopes\u201d.");
                return false;
            }
            if (!(importMapEntry.getValue() instanceof Map)) {
                err("The value of the \u201c" + specifierType + "\u201d"
                        + " property within the content of a \u201cscript\u201d"
                        + " element with a \u201ctype\u201d attribute whose"
                        + " value is \u201cimportmap\u201d must be a JSON"
                        + " object.");
                return false;
            }

            Map<String, Object> importMapValue = (Map<String, Object>) importMapEntry.getValue();
            for (Map.Entry<String, Object> entry : importMapValue.entrySet()) {

                if ("imports".equals(specifierType)) {
                    if (!isSpecifierMapValid(specifierType, entry.getKey(),
                            entry.getValue())) {
                        return false;
                    }
                } else if ("scopes".equals(specifierType)) {
                    if (!isValidURL(entry.getKey())) {
                        err("The value of the \u201cscopes\u201d property"
                                + " within the content of a \u201cscript\u201d"
                                + " element with a \u201ctype\u201d attribute"
                                + " whose value is \u201cimportmap\u201d must"
                                + " be a JSON object whose keys are valid URL"
                                + " strings.");
                        return false;
                    }
                    if (!(entry.getValue() instanceof Map)) {
                        err("The value of the \u201cscopes\u201d property"
                                + " within the content of a \u201cscript\u201d"
                                + " element with a \u201ctype\u201d attribute"
                                + " whose value is \u201cimportmap\u201d must"
                                + " be a JSON object whose values are also"
                                + " JSON objects.");
                        return false;
                    }
                    Map<String, Object> scopesMap = (Map<String, Object>) entry.getValue();
                    for (Map.Entry<String, Object> scopesEntry : scopesMap.entrySet()) {
                        if (!isSpecifierMapValid(specifierType,
                                scopesEntry.getKey(), scopesEntry.getValue())) {
                            return false;
                        }
                    }
                }
            }
        }
        return true;
    }
@see nu.validator.checker.Checker#endElement(java.lang.String,
     java.lang.String, java.lang.String)
src/nu/validator/checker/schematronequiv/Assertions.java