1 | /** |
---|
2 | * This software is copyright (c) 2012-2014 by |
---|
3 | * - Institut fuer Deutsche Sprache (http://www.ids-mannheim.de) |
---|
4 | * This is free software. You can redistribute it |
---|
5 | * and/or modify it under the terms described in |
---|
6 | * the GNU General Public License v3 of which you |
---|
7 | * should have received a copy. Otherwise you can download |
---|
8 | * it from |
---|
9 | * |
---|
10 | * http://www.gnu.org/licenses/gpl-3.0.txt |
---|
11 | * |
---|
12 | * @copyright Institut fuer Deutsche Sprache (http://www.ids-mannheim.de) |
---|
13 | * |
---|
14 | * @license http://www.gnu.org/licenses/gpl-3.0.txt |
---|
15 | * GNU General Public License v3 |
---|
16 | */ |
---|
17 | package eu.clarin.sru.client.fcs; |
---|
18 | |
---|
19 | import java.util.List; |
---|
20 | |
---|
21 | import javax.xml.stream.XMLStreamException; |
---|
22 | import javax.xml.stream.XMLStreamReader; |
---|
23 | |
---|
24 | import eu.clarin.sru.client.SRUClientException; |
---|
25 | import eu.clarin.sru.client.SRURecordData; |
---|
26 | |
---|
27 | |
---|
28 | /** |
---|
29 | * A record data parse to parse records conforming to CLARIN-FCS specification. |
---|
30 | */ |
---|
31 | public class ClarinFCSRecordDataParser extends |
---|
32 | AbstractClarinFCSRecordDataParser { |
---|
33 | |
---|
34 | |
---|
35 | /** |
---|
36 | * Constructor. |
---|
37 | * |
---|
38 | * @param parsers |
---|
39 | * the list of data view parsers to be used by this record data |
---|
40 | * parser. This list should contain one |
---|
41 | * {@link DataViewParserGenericDOM} or |
---|
42 | * {@link DataViewParserGenericString} instance. |
---|
43 | * @throws NullPointerException |
---|
44 | * if parsers is <code>null</code> |
---|
45 | * @throws IllegalArgumentException |
---|
46 | * if parsers is empty or contains duplicate entries |
---|
47 | */ |
---|
48 | public ClarinFCSRecordDataParser(List<DataViewParser> parsers) { |
---|
49 | super(parsers); |
---|
50 | } |
---|
51 | |
---|
52 | |
---|
53 | |
---|
54 | @Override |
---|
55 | public String getRecordSchema() { |
---|
56 | return ClarinFCSRecordData.RECORD_SCHEMA; |
---|
57 | } |
---|
58 | |
---|
59 | |
---|
60 | @Override |
---|
61 | public SRURecordData parse(XMLStreamReader reader) |
---|
62 | throws XMLStreamException, SRUClientException { |
---|
63 | logger.debug("parsing CLARIN-FCS record"); |
---|
64 | |
---|
65 | return parse(reader, ClarinFCSRecordData.RECORD_SCHEMA); |
---|
66 | } |
---|
67 | |
---|
68 | } // class ClarinFCSRecordParser |
---|