diff -r 3d5cc308e268 -r c703fb7f088f java/alt2xml-cli/src/cz/frantovo/alt2xml/cli/CLIOptions.java --- a/java/alt2xml-cli/src/cz/frantovo/alt2xml/cli/CLIOptions.java Thu Jul 03 00:18:35 2014 +0200 +++ b/java/alt2xml-cli/src/cz/frantovo/alt2xml/cli/CLIOptions.java Thu Jul 03 00:37:38 2014 +0200 @@ -23,6 +23,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Properties; +import org.xml.sax.InputSource; /** * Holds options from command line, validates them, combines with configuration and provides derived @@ -34,7 +35,6 @@ private File inputFile; private InputStream inputStream; - private String inputUrl; private String systemId; private final Properties readerProperties = new Properties(); @@ -48,7 +48,7 @@ InvalidOptionsException e = new InvalidOptionsException(); /** - * TODO: validace + * TODO: validate */ if (e.hasProblems()) { throw e; @@ -63,22 +63,41 @@ this.inputStream = inputStream; } - public void setInputUrl(String inputUrl) { - this.inputUrl = inputUrl; - } - public void setSystemId(String systemId) { this.systemId = systemId; } - + + public InputSource getInputSource() { + InputSource is = new InputSource(); + + if (inputFile != null) { + is.setSystemId(inputFile.toURI().toASCIIString()); + } + + if (inputStream != null) { + is.setByteStream(inputStream); + is.setSystemId(systemId); + } + + return is; + } + public void setOutputStream(OutputStream outputStream) { this.outputStream = outputStream; } - + + public OutputStream getOutputStream() { + return outputStream; + } + public void setAction(String action) { this.action = action; } + public String getAction() { + return action; + } + public void addReaderProperty(String name, String value) { readerProperties.put(name, value); }