use of org.hl7.fhir.definitions.validation.XmlValidator in project kindling by HL7.
the class Publisher method initialize.
private boolean initialize(String folder) throws Exception {
HierarchicalTableGenerator.ACTIVE_TABLES = true;
page.setDefinitions(new Definitions());
page.getWorkerContext().setCanRunWithoutTerminology(!web);
page.log("Checking Source for " + folder, LogMessageType.Process);
List<String> errors = new ArrayList<String>();
Utilities.checkFolder(page.getFolders().rootDir, errors);
if (checkFile("required", page.getFolders().rootDir, "publish.ini", errors, "all")) {
checkFile("required", page.getFolders().srcDir, "navigation.xml", errors, "all");
page.setIni(new IniFile(page.getFolders().rootDir + "publish.ini"));
page.setVersion(FHIRVersion.fromCode(page.getIni().getStringProperty("FHIR", "version")));
prsr = new SourceParser(page, folder, page.getDefinitions(), web, page.getVersion(), page.getWorkerContext(), page.getGenDate(), page, fpUsages, isCIBuild);
prsr.checkConditions(errors, dates);
page.setRegistry(prsr.getRegistry());
page.getDiffEngine().loadFromIni(prsr.getIni());
for (String s : page.getIni().getPropertyNames("special-pages")) page.getDefinitions().getStructuralPages().add(s);
Utilities.checkFolder(page.getFolders().xsdDir, errors);
checkFile("required", page.getFolders().srcDir, "hierarchy.xml", errors, "all");
checkFile("required", page.getFolders().srcDir, "fhir-all.xsd", errors, "all");
checkFile("required", page.getFolders().templateDir, "template.html", errors, "all");
checkFile("required", page.getFolders().templateDir, "template-book.html", errors, "all");
checkFile("required", page.getFolders().srcDir, "mappingSpaces.xml", errors, "all");
if (page.getIni().getPropertyNames("support") != null)
for (String n : page.getIni().getPropertyNames("support")) checkFile("support", page.getFolders().srcDir, n, errors, "all");
for (String n : page.getIni().getPropertyNames("images")) checkFile("image", page.getFolders().imgDir, n, errors, "all");
for (String n : page.getIni().getPropertyNames("schema")) checkFile("schema", page.getFolders().srcDir, n, errors, "all");
for (String n : page.getIni().getPropertyNames("pages")) checkFile("page", page.getFolders().srcDir, n, errors, "page-" + n);
for (String n : page.getIni().getPropertyNames("files")) checkFile("file", page.getFolders().rootDir, n, errors, "page-" + n);
}
if (checkFile("translations", page.getFolders().rootDir + "implementations" + File.separator, "translations.xml", errors, null)) {
// schema check
XmlValidator xv = new XmlValidator(page.getValidationErrors(), page.getFolders().rootDir + "implementations", Utilities.path(page.getFolders().rootDir, "tools", "schematron"), new String[] { "translations.xsd" });
xv.checkBySchema(Utilities.path(page.getFolders().rootDir, "implementations", "translations.xml"), true);
Utilities.copyFile(page.getFolders().rootDir + "implementations" + File.separator + "translations.xml", page.getFolders().dstDir + "translations.xml");
page.getTranslations().setLang("en");
page.getTranslations().load(page.getFolders().rootDir + "implementations" + File.separator + "translations.xml");
}
if (errors.size() > 0)
page.log("Unable to publish FHIR specification:", LogMessageType.Error);
for (String e : errors) {
page.log(e, LogMessageType.Error);
}
return errors.size() == 0;
}
use of org.hl7.fhir.definitions.validation.XmlValidator in project kindling by HL7.
the class ExampleInspector method prepare.
public void prepare() throws Exception {
validator = new InstanceValidator(context, hostServices, null);
validator.setSuppressLoincSnomedMessages(true);
validator.setResourceIdRule(IdStatus.REQUIRED);
validator.setBestPracticeWarningLevel(BestPracticeWarningLevel.Warning);
validator.getExtensionDomains().add("http://hl7.org/fhir/us");
validator.setFetcher(this);
validator.setAllowExamples(true);
validator.setDebug(false);
xml = new XmlValidator(errorsInt, loadSchemas(), loadTransforms());
if (VALIDATE_BY_JSON_SCHEMA) {
String source = TextFile.fileToString(Utilities.path(rootDir, "fhir.schema.json"));
JSONObject rawSchema = new JSONObject(new JSONTokener(source));
jschema = SchemaLoader.load(rawSchema);
}
if (VALIDATE_RDF) {
shex = new ShExValidator(Utilities.path(rootDir, "fhir.shex"));
}
fpe = new FHIRPathEngine(context);
checkJsonLd();
}
Aggregations