All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.thaiopensource.relaxng.input.xml.XmlInputFormat Maven / Gradle / Ivy

The newest version!
package com.thaiopensource.relaxng.input.xml;

import com.thaiopensource.relaxng.edit.SchemaCollection;
import com.thaiopensource.relaxng.input.AbstractMultiInputFormat;
import com.thaiopensource.relaxng.input.InputFailedException;
import com.thaiopensource.relaxng.translate.util.EncodingParam;
import com.thaiopensource.relaxng.translate.util.InvalidParamsException;
import com.thaiopensource.relaxng.translate.util.ParamProcessor;
import com.thaiopensource.resolver.Resolver;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;

import java.io.IOException;

public class XmlInputFormat extends AbstractMultiInputFormat {
  public SchemaCollection load(String[] uris, String[] params, String outputFormat, ErrorHandler eh, Resolver resolver)
          throws InputFailedException, InvalidParamsException, IOException, SAXException {
    ParamProcessor pp = new ParamProcessor();
    final Inferrer.Options options = new Inferrer.Options();
    options.resolver = resolver;
    pp.declare("encoding",
               new EncodingParam() {
                 protected void setEncoding(String encoding) {
                   options.encoding = encoding;
                 }
               });
    pp.process(params, eh);
    return Inferrer.infer(uris, options, eh);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy