java/alt2xml-lib/src/cz/frantovo/alt2xml/SuperReader.java
changeset 21 ac4e617f44e7
parent 19 a58dce1054af
child 22 23a12c58b57c
     1.1 --- a/java/alt2xml-lib/src/cz/frantovo/alt2xml/SuperReader.java	Sat Jun 07 11:28:27 2014 +0200
     1.2 +++ b/java/alt2xml-lib/src/cz/frantovo/alt2xml/SuperReader.java	Sat Jun 07 15:03:52 2014 +0200
     1.3 @@ -18,7 +18,7 @@
     1.4  package cz.frantovo.alt2xml;
     1.5  
     1.6  import java.io.IOException;
     1.7 -import java.io.InputStreamReader;
     1.8 +import java.net.URI;
     1.9  import java.util.HashMap;
    1.10  import java.util.Map;
    1.11  import org.xml.sax.ContentHandler;
    1.12 @@ -41,7 +41,7 @@
    1.13  	private ErrorHandler errorHandler;
    1.14  	private DTDHandler dtdHandler;
    1.15  	private EntityResolver entityResolver;
    1.16 -	private Map<String, Object> konfigurace = new HashMap<>();
    1.17 +	private Map<String, Object> properties = new HashMap<>();
    1.18  	private final ReaderFinder readerFinder;
    1.19  
    1.20  	public SuperReader(ReaderFinder readerFinder) {
    1.21 @@ -50,20 +50,11 @@
    1.22  
    1.23  	@Override
    1.24  	public void parse(InputSource input) throws IOException, SAXException {
    1.25 -		/**
    1.26 -		 * TODO: rozpornat formát vstupu a podle toho delegovat
    1.27 -		 */
    1.28 -		//JSONParser p = new JSONParser();
    1.29 -		InputStreamReader vstup = new InputStreamReader(input.getByteStream());
    1.30 -		//JsonSimpleContentHandler handler = new JsonSimpleContentHandler(contentHandler);
    1.31  
    1.32 -		/*
    1.33 -		 try {
    1.34 -		 p.parse(vstup, handler);
    1.35 -		 } catch (ParseException e) {
    1.36 -		 throw new SAXException("Chyba při načítání JSONu", e);
    1.37 -		 }
    1.38 -		 */
    1.39 +		System.err.println("SystemId: " + input.getSystemId());
    1.40 +		
    1.41 +		XMLReader reader = readerFinder.findReader(input.getSystemId());
    1.42 +		reader.parse(input);
    1.43  	}
    1.44  
    1.45  	@Override
    1.46 @@ -89,12 +80,12 @@
    1.47  
    1.48  	@Override
    1.49  	public Object getProperty(String name) throws SAXNotRecognizedException, SAXNotSupportedException {
    1.50 -		return konfigurace.get(name);
    1.51 +		return properties.get(name);
    1.52  	}
    1.53  
    1.54  	@Override
    1.55  	public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException {
    1.56 -		konfigurace.put(name, value);
    1.57 +		properties.put(name, value);
    1.58  	}
    1.59  
    1.60  	@Override