use of org.hl7.fhir.r5.conformance.ShExGenerator in project org.hl7.fhir.core by hapifhir.
the class ShexGeneratorTests method doTest.
private void doTest(String name) throws IOException, FHIRException {
// FileSystems.getDefault().getPath(System.getProperty("user.dir"), "data").toString();
String workingDirectory = "C:\\work\\org.hl7.fhir.2016May\\build\\publish";
if (TestingUtilities.context == null) {
// For the time being, put the validation entry in org/hl7/fhir/dstu3/data
Path path = FileSystems.getDefault().getPath(workingDirectory, "validation-min.xml.zip");
TestingUtilities.context = SimpleWorkerContext.fromPack(path.toString());
}
StructureDefinition sd = TestingUtilities.context.fetchTypeDefinition(name);
if (sd == null) {
throw new FHIRException("StructuredDefinition for " + name + "was null");
}
Path outPath = FileSystems.getDefault().getPath(workingDirectory, name + ".shex");
TextFile.stringToFile(new ShExGenerator(TestingUtilities.context).generate(HTMLLinkPolicy.NONE, sd), outPath.toString());
}
use of org.hl7.fhir.r5.conformance.ShExGenerator in project org.hl7.fhir.core by hapifhir.
the class ShexGeneratorTests method doTest.
private void doTest(String name) throws FileNotFoundException, IOException, FHIRException {
// FileSystems.getDefault().getPath(System.getProperty("user.dir"), "data").toString();
String workingDirectory = "C:\\work\\org.hl7.fhir.2016May\\build\\publish";
// String workingDirectory = FileSystems.getDefault().getPath(System.getProperty("user.dir"), "..", "..", "..", "publish").toString();
if (TestingUtilities.context == null) {
// For the time being, put the validation entry in org/hl7/fhir/dstu3/data
Path path = FileSystems.getDefault().getPath(workingDirectory, "validation-min.xml.zip");
TestingUtilities.context = SimpleWorkerContext.fromPack(path.toString());
}
StructureDefinition sd = TestingUtilities.context.fetchTypeDefinition(name);
if (sd == null) {
throw new FHIRException("StructuredDefinition for " + name + "was null");
}
Path outPath = FileSystems.getDefault().getPath(workingDirectory, name.toLowerCase() + ".shex");
TextFile.stringToFile(new ShExGenerator(TestingUtilities.context).generate(HTMLLinkPolicy.NONE, sd), outPath.toString());
}
Aggregations