Statistics
| Revision:

root / branches / v2_0_0_prep / libraries / libGPE-XML / src / org / gvsig / gpe / xml / stream / kxml / KxmlXmlParserFactory.java @ 27598

History | View | Annotate | Download (2.44 KB)

1
package org.gvsig.gpe.xml.stream.kxml;
2

    
3
import java.io.InputStream;
4

    
5
import org.gvsig.gpe.xml.stream.IXmlStreamReader;
6
import org.gvsig.gpe.xml.stream.IXmlStreamReaderFactory;
7
import org.gvsig.gpe.xml.stream.XmlStreamException;
8

    
9
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
10
 *
11
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
12
 *
13
 * This program is free software; you can redistribute it and/or
14
 * modify it under the terms of the GNU General Public License
15
 * as published by the Free Software Foundation; either version 2
16
 * of the License, or (at your option) any later version.
17
 *
18
 * This program is distributed in the hope that it will be useful,
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 * GNU General Public License for more details.
22
 *
23
 * You should have received a copy of the GNU General Public License
24
 * along with this program; if not, write to the Free Software
25
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
26
 *
27
 * For more information, contact:
28
 *
29
 *  Generalitat Valenciana
30
 *   Conselleria d'Infraestructures i Transport
31
 *   Av. Blasco Ib??ez, 50
32
 *   46010 VALENCIA
33
 *   SPAIN
34
 *
35
 *      +34 963862235
36
 *   gvsig@gva.es
37
 *      www.gvsig.gva.es
38
 *
39
 *    or
40
 *
41
 *   IVER T.I. S.A
42
 *   Salamanca 50
43
 *   46005 Valencia
44
 *   Spain
45
 *
46
 *   +34 963163400
47
 *   dac@iver.es
48
 */
49
/* CVS MESSAGES:
50
 *
51
 * $Id$
52
 * $Log$
53
 *
54
 */
55
/**
56
 * @author Jorge Piera Llodr? (jorge.piera@iver.es)
57
 */
58
public class KxmlXmlParserFactory implements IXmlStreamReaderFactory {
59

    
60
    /**
61
     * @see org.gvsig.gpe.xml.stream.IXmlStreamReaderFactory#canParse(java.lang.String)
62
     */
63
    public boolean canParse(String mimeType) {
64
        return mimeType.startsWith("text/xml");
65
    }
66

    
67
    /**
68
     * @see org.gvsig.gpe.xml.stream.IXmlStreamReaderFactory#createParser(java.lang.String,
69
     *      java.io.InputStream)
70
     */
71
    public IXmlStreamReader createParser(String mimeType, final InputStream in)
72
            throws XmlStreamException, IllegalArgumentException {
73
        if (!canParse(mimeType)) {
74
            throw new IllegalArgumentException("Unsupported mime type for this reader factory: "
75
                    + mimeType);
76
        }
77
        KxmlXmlStreamReader reader = new KxmlXmlStreamReader(in);
78
        reader.setInput(in);
79
        return reader;
80
    }
81
}
82