| 1 |
package com.thaiopensource.relaxng.input.xml; |
| 2 |
|
| 3 |
import com.thaiopensource.relaxng.edit.SchemaCollection; |
| 4 |
import com.thaiopensource.relaxng.input.AbstractMultiInputFormat; |
| 5 |
import com.thaiopensource.relaxng.input.InputFailedException; |
| 6 |
import com.thaiopensource.relaxng.translate.util.EncodingParam; |
| 7 |
import com.thaiopensource.relaxng.translate.util.InvalidParamsException; |
| 8 |
import com.thaiopensource.relaxng.translate.util.ParamProcessor; |
| 9 |
import com.thaiopensource.resolver.Resolver; |
| 10 |
import org.xml.sax.ErrorHandler; |
| 11 |
import org.xml.sax.SAXException; |
| 12 |
|
| 13 |
import java.io.IOException; |
| 14 |
|
| 15 |
public class XmlInputFormat extends AbstractMultiInputFormat { |
| 16 |
public SchemaCollection load(String[] uris, String[] params, String outputFormat, ErrorHandler eh, Resolver resolver) |
| 17 |
throws InputFailedException, InvalidParamsException, IOException, SAXException { |
| 18 |
ParamProcessor pp = new ParamProcessor(); |
| 19 |
final Inferrer.Options options = new Inferrer.Options(); |
| 20 |
options.resolver = resolver; |
| 21 |
pp.declare("encoding", |
| 22 |
new EncodingParam() { |
| 23 |
protected void setEncoding(String encoding) { |
| 24 |
options.encoding = encoding; |
| 25 |
} |
| 26 |
}); |
| 27 |
pp.process(params, eh); |
| 28 |
return Inferrer.infer(uris, options, eh); |
| 29 |
} |
| 30 |
} |