Merge pull request #40 from vadi2/output-json-snapshot

Also output JSON if requested for narrative, snapshot generation & transforms
This commit is contained in:
Grahame Grieve 2019-06-03 19:20:03 +10:00 committed by GitHub
commit cb843d8235
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -484,6 +484,8 @@ public class Validator {
private static void handleOutputToStream(Resource r, String output, OutputStream s) throws IOException {
if (output.endsWith(".html") || output.endsWith(".htm") && r instanceof DomainResource)
new XhtmlComposer(XhtmlComposer.HTML, true).compose(s, ((DomainResource) r).getText().getDiv());
else if (output.endsWith(".json"))
new JsonParser().setOutputStyle(OutputStyle.PRETTY).compose(s, r);
else
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(s, r);
s.close();