| 1 |
package com.thaiopensource.relaxng.translate; |
| 2 |
|
| 3 |
import com.thaiopensource.relaxng.input.InputFormat; |
| 4 |
import com.thaiopensource.relaxng.input.xml.XmlInputFormat; |
| 5 |
import com.thaiopensource.relaxng.input.dtd.DtdInputFormat; |
| 6 |
import com.thaiopensource.relaxng.input.parse.sax.SAXParseInputFormat; |
| 7 |
import com.thaiopensource.relaxng.input.parse.compact.CompactParseInputFormat; |
| 8 |
import com.thaiopensource.relaxng.output.OutputFormat; |
| 9 |
import com.thaiopensource.relaxng.output.rnc.RncOutputFormat; |
| 10 |
import com.thaiopensource.relaxng.output.xsd.XsdOutputFormat; |
| 11 |
import com.thaiopensource.relaxng.output.rng.RngOutputFormat; |
| 12 |
import com.thaiopensource.relaxng.output.dtd.DtdOutputFormat; |
| 13 |
|
| 14 |
public class Formats { |
| 15 |
private Formats() { |
| 16 |
} |
| 17 |
|
| 18 |
static public InputFormat createInputFormat(String name) { |
| 19 |
if (name.equalsIgnoreCase("rng")) |
| 20 |
return new SAXParseInputFormat(); |
| 21 |
if (name.equalsIgnoreCase("rnc")) |
| 22 |
return new CompactParseInputFormat(); |
| 23 |
if (name.equalsIgnoreCase("dtd")) |
| 24 |
return new DtdInputFormat(); |
| 25 |
if (name.equalsIgnoreCase("xml")) |
| 26 |
return new XmlInputFormat(); |
| 27 |
return null; |
| 28 |
} |
| 29 |
|
| 30 |
static public OutputFormat createOutputFormat(String name) { |
| 31 |
if (name.equalsIgnoreCase("dtd")) |
| 32 |
return new DtdOutputFormat(); |
| 33 |
else if (name.equalsIgnoreCase("rng")) |
| 34 |
return new RngOutputFormat(); |
| 35 |
else if (name.equalsIgnoreCase("xsd")) |
| 36 |
return new XsdOutputFormat(); |
| 37 |
else if (name.equalsIgnoreCase("rnc")) |
| 38 |
return new RncOutputFormat(); |
| 39 |
return null; |
| 40 |
} |
| 41 |
} |