Also output JSON if requested for narrative, snapshot generation & transformations

This commit is contained in:
Vadim Peretokin 2019-06-02 14:08:58 +02:00
parent 7d38ed4161
commit ed32fca1d4
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();