| 1 |
package com.thaiopensource.relaxng.output.dtd; |
| 2 |
|
| 3 |
import com.thaiopensource.relaxng.output.OutputFormat; |
| 4 |
import com.thaiopensource.relaxng.output.OutputDirectory; |
| 5 |
import com.thaiopensource.relaxng.output.OutputFailedException; |
| 6 |
import com.thaiopensource.relaxng.output.OutputDirectoryParamProcessor; |
| 7 |
import com.thaiopensource.relaxng.output.common.ErrorReporter; |
| 8 |
import com.thaiopensource.relaxng.edit.SchemaCollection; |
| 9 |
import com.thaiopensource.relaxng.translate.util.InvalidParamsException; |
| 10 |
import org.xml.sax.ErrorHandler; |
| 11 |
import org.xml.sax.SAXException; |
| 12 |
|
| 13 |
import java.io.IOException; |
| 14 |
|
| 15 |
public class DtdOutputFormat implements OutputFormat { |
| 16 |
public void output(SchemaCollection sc, final OutputDirectory od, String[] params, String inputFormat, ErrorHandler eh) |
| 17 |
throws SAXException, IOException, OutputFailedException, InvalidParamsException { |
| 18 |
new OutputDirectoryParamProcessor(od).process(params, eh); |
| 19 |
Simplifier.simplify(sc); |
| 20 |
try { |
| 21 |
ErrorReporter er = new ErrorReporter(eh, DtdOutputFormat.class); |
| 22 |
Analysis analysis = new Analysis(sc, er); |
| 23 |
if (!er.getHadError()) |
| 24 |
DtdOutput.output(!inputFormat.equals("xml"), analysis, od, er); |
| 25 |
if (er.getHadError()) |
| 26 |
throw new OutputFailedException(); |
| 27 |
} |
| 28 |
catch (ErrorReporter.WrappedSAXException e) { |
| 29 |
throw e.getException(); |
| 30 |
} |
| 31 |
} |
| 32 |
} |