response.setContentType("application/xhtml+xml");
contentHandler =
new XmlSerializer(out);
}
emitter = new XhtmlSaxEmitter(contentHandler);
errorHandler = new MessageEmitterAdapter(sourceCode,
showSource, imageCollector, lineOffset, false,
new XhtmlMessageEmitter(contentHandler));
if (W3C_BRANDING) {
W3CPageEmitter.emit(contentHandler, this);
} else {
PageEmitter.emit(contentHandler, this);
}
} else {
if (outputFormat == OutputFormat.TEXT) {
response.setContentType("text/plain; charset=utf-8");
errorHandler = new MessageEmitterAdapter(sourceCode,
showSource, null, lineOffset, false,
new TextMessageEmitter(out, asciiQuotes));
} else if (outputFormat == OutputFormat.GNU) {
response.setContentType("text/plain; charset=utf-8");
errorHandler = new MessageEmitterAdapter(sourceCode,
showSource, null, lineOffset, false,
new GnuMessageEmitter(out, asciiQuotes));
} else if (outputFormat == OutputFormat.XML) {
response.setContentType("application/xml");
errorHandler = new MessageEmitterAdapter(sourceCode,
showSource, null, lineOffset, false,
new XmlMessageEmitter(new XmlSerializer(out)));
} else if (outputFormat == OutputFormat.JSON) {
if (callback == null) {
response.setContentType("application/json; charset=utf-8");
} else {
response.setContentType("application/javascript; charset=utf-8");
}
errorHandler = new MessageEmitterAdapter(sourceCode,
showSource, null, lineOffset, false,
new JsonMessageEmitter(
new nu.validator.json.Serializer(out),
callback));
} else {