Our cz.frantovo.alt2xml.ParserFactory will not be hardcoded – will be set over the system property: javax.xml.parsers.SAXParserFactory
authorFrantišek Kučera <franta-hg@frantovo.cz>
Sat, 07 Jun 2014 21:57:50 +0200
changeset 31c9f1e497132e
parent 30 f696e73de225
child 32 ecc2731a5a46
Our cz.frantovo.alt2xml.ParserFactory will not be hardcoded – will be set over the system property: javax.xml.parsers.SAXParserFactory
so we can use alt2xml CLI with just standard SAX parser and enjoy it for pure XML as a framework with output modules
java/alt2xml-cli/src/cz/frantovo/alt2xml/cli/CLI.java
scripts/alt2xml.sh
     1.1 --- a/java/alt2xml-cli/src/cz/frantovo/alt2xml/cli/CLI.java	Sat Jun 07 20:32:44 2014 +0200
     1.2 +++ b/java/alt2xml-cli/src/cz/frantovo/alt2xml/cli/CLI.java	Sat Jun 07 21:57:50 2014 +0200
     1.3 @@ -17,7 +17,6 @@
     1.4   */
     1.5  package cz.frantovo.alt2xml.cli;
     1.6  
     1.7 -import cz.frantovo.alt2xml.ParserFactory;
     1.8  import java.io.File;
     1.9  import java.io.OutputStream;
    1.10  import java.util.Arrays;
    1.11 @@ -55,8 +54,7 @@
    1.12  			XMLStreamWriter w = xmlOutputFactory.createXMLStreamWriter(výstup);
    1.13  			DefaultHandler h = new EchoContentHandler(w);
    1.14  
    1.15 -			SAXParserFactory t = SAXParserFactory.newInstance(ParserFactory.class.getName(), null);
    1.16 -			//SAXParserFactory t = SAXParserFactory.newInstance();
    1.17 +			SAXParserFactory t = SAXParserFactory.newInstance();
    1.18  			SAXParser p = t.newSAXParser();
    1.19  			p.parse(vstup, h);
    1.20  		} catch (Exception e) {
     2.1 --- a/scripts/alt2xml.sh	Sat Jun 07 20:32:44 2014 +0200
     2.2 +++ b/scripts/alt2xml.sh	Sat Jun 07 21:57:50 2014 +0200
     2.3 @@ -19,6 +19,7 @@
     2.4  done
     2.5  
     2.6  MAIN_CLASS="cz.frantovo.alt2xml.cli.CLI";
     2.7 +SAX_PARSER_FACTORY="cz.frantovo.alt2xml.ParserFactory";
     2.8  
     2.9 -java -cp "$CLASS_PATH" $MAIN_CLASS "$@"
    2.10 +java -cp "$CLASS_PATH" -D"javax.xml.parsers.SAXParserFactory=$SAX_PARSER_FACTORY" $MAIN_CLASS "$@"
    2.11