diff -r b890783e4043 -r b2fbb3570ae1 java/alt2xml-bin/src/cz/frantovo/alt2xml/CLI.java --- a/java/alt2xml-bin/src/cz/frantovo/alt2xml/CLI.java Sat Jun 07 10:38:31 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/** - * Alt2XML - * Copyright © 2014 František Kučera (frantovo.cz) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package cz.frantovo.alt2xml; - -import cz.frantovo.alt2xml.výstup.EchoContentHandler; -import java.io.InputStream; -import java.io.OutputStream; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; -import javax.xml.stream.XMLOutputFactory; -import javax.xml.stream.XMLStreamWriter; -import org.xml.sax.helpers.DefaultHandler; - -/** - * - * @author fiki - */ -public class CLI { - - public static void main(String[] args) throws Exception { - /** - * Použijeme standardní vstup a výstup: - */ - InputStream vstup = System.in; - OutputStream výstup = System.out; - - /** - * Serializujeme data do XML. - * To normálně vůbec není potřeba – data se do tvaru proudu obsahujícího ostré závorky - * vůbec nedostanou – zpracováváme události (volání javovských metod – začátky a konce elementů atd.) - * a z nich např. deserializujeme nějaké naše objekty, provádíme nějaké akce, nebo třeba stavíme DOM. - */ - XMLOutputFactory xmlOutputFactory = XMLOutputFactory.newFactory(); - XMLStreamWriter w = xmlOutputFactory.createXMLStreamWriter(výstup); - DefaultHandler h = new EchoContentHandler(w); - - /** - * Parsujeme JSON a děláme z něj XML: - */ - SAXParserFactory t = SAXParserFactory.newInstance(SAXTovarna.class.getName(), null); - SAXParser p = t.newSAXParser(); - p.parse(vstup, h); - } -}