1.1 --- a/java/alt2xml-cli/src/cz/frantovo/alt2xml/cli/CLI.java Mon Jun 16 11:11:01 2014 +0200
1.2 +++ b/java/alt2xml-cli/src/cz/frantovo/alt2xml/cli/CLI.java Mon Jun 16 13:16:45 2014 +0200
1.3 @@ -30,8 +30,7 @@
1.4 import java.util.logging.Logger;
1.5 import javax.xml.parsers.SAXParser;
1.6 import javax.xml.parsers.SAXParserFactory;
1.7 -import org.xml.sax.ext.LexicalHandler;
1.8 -import org.xml.sax.helpers.DefaultHandler;
1.9 +import org.xml.sax.InputSource;
1.10
1.11 /**
1.12 *
1.13 @@ -39,13 +38,12 @@
1.14 */
1.15 public class CLI {
1.16
1.17 - public static final String LEXICAL_HANDLER_PROPERTY = "http://xml.org/sax/properties/lexical-handler";
1.18 private static final Logger log = Logger.getLogger(CLI.class.getName());
1.19
1.20 public static void main(String[] args) {
1.21
1.22 try {
1.23 - File vstup = new File(args[0]);
1.24 + File inputFile = new File(args[0]);
1.25 String actionCode = args[1];
1.26 OutputStream outputStream = System.out;
1.27
1.28 @@ -66,26 +64,10 @@
1.29 ActionContext actionContext = new ActionContext(outputStream);
1.30 Action action = actionFactory.getAction(actionContext);
1.31
1.32 - DefaultHandler defaultHandler = action.getDefaultHandler();
1.33 - LexicalHandler lexicalHandler = action.getLexicalHandler();
1.34 -
1.35 SAXParserFactory t = SAXParserFactory.newInstance();
1.36 SAXParser p = t.newSAXParser();
1.37
1.38 - if (lexicalHandler == null) {
1.39 - log.log(Level.FINE, "No LexicalHandler provided.");
1.40 - } else {
1.41 - try {
1.42 - p.setProperty(LEXICAL_HANDLER_PROPERTY, defaultHandler);
1.43 - } catch (Exception e) {
1.44 - log.log(Level.WARNING, "LexicalHandler registration exception:", e);
1.45 - log.log(Level.WARNING,
1.46 - "Tried to register the handler {0} as a LexicalHandler but LexicalHandlers are not supported by the parser {1}",
1.47 - new Object[]{defaultHandler, p});
1.48 - }
1.49 - }
1.50 -
1.51 - p.parse(vstup, defaultHandler);
1.52 + action.run(p, new InputSource(inputFile.toURI().toASCIIString()));
1.53 }
1.54
1.55 } catch (Exception e) {