Mercurial > hg > mpdl-group
comparison software/mpdl-services/mpiwg-mpdl-lt/src/de/mpg/mpiwg/berlin/mpdl/lt/morph/app/SimpleMorphContentHandler.java @ 23:e845310098ba
diverse Korrekturen
author | Josef Willenborg <jwillenborg@mpiwg-berlin.mpg.de> |
---|---|
date | Tue, 27 Nov 2012 12:35:19 +0100 |
parents | 4a3641ae14d2 |
children |
comparison
equal
deleted
inserted
replaced
22:6a45a982c333 | 23:e845310098ba |
---|---|
1 package de.mpg.mpiwg.berlin.mpdl.lt.morph.app; | 1 package de.mpg.mpiwg.berlin.mpdl.lt.morph.app; |
2 | |
3 import java.util.ArrayList; | |
2 | 4 |
3 import org.xml.sax.*; | 5 import org.xml.sax.*; |
4 | 6 |
5 | 7 |
6 public class SimpleMorphContentHandler implements ContentHandler { | 8 public class SimpleMorphContentHandler implements ContentHandler { |
7 private Element currentElement; | 9 private Element currentElement; |
8 private Lemma lemma; | 10 private Lemma lemma; |
9 private Form form; | 11 private Form form; |
12 private ArrayList<Lemma> lemmas; | |
13 private ArrayList<Form> forms; | |
10 | 14 |
11 public SimpleMorphContentHandler() { | 15 public SimpleMorphContentHandler() { |
12 } | 16 } |
13 | 17 |
14 public Form getForm() { | 18 public Form getForm() { |
17 | 21 |
18 public Lemma getLemma() { | 22 public Lemma getLemma() { |
19 return lemma; | 23 return lemma; |
20 } | 24 } |
21 | 25 |
26 public ArrayList<Form> getForms() { | |
27 return forms; | |
28 } | |
29 | |
30 public ArrayList<Lemma> getLemmas() { | |
31 return lemmas; | |
32 } | |
33 | |
22 public void startDocument() throws SAXException { | 34 public void startDocument() throws SAXException { |
23 } | 35 } |
24 | 36 |
25 public void endDocument() throws SAXException { | 37 public void endDocument() throws SAXException { |
26 } | 38 } |
93 | 105 |
94 public void startElement(String uri, String localName, String name, Attributes attrs) throws SAXException { | 106 public void startElement(String uri, String localName, String name, Attributes attrs) throws SAXException { |
95 currentElement = new Element(name); | 107 currentElement = new Element(name); |
96 if (name.equals("form")) { | 108 if (name.equals("form")) { |
97 form = new Form(); | 109 form = new Form(); |
110 if (forms == null) | |
111 forms = new ArrayList<Form>(); | |
112 forms.add(form); | |
98 } else if (name.equals("lemma")) { | 113 } else if (name.equals("lemma")) { |
99 lemma = new Lemma(); | 114 lemma = new Lemma(); |
115 if (lemmas == null) | |
116 lemmas = new ArrayList<Lemma>(); | |
117 lemmas.add(lemma); | |
100 } | 118 } |
101 } | 119 } |
102 | 120 |
103 public void startPrefixMapping(String prefix, String uri) throws SAXException { | 121 public void startPrefixMapping(String prefix, String uri) throws SAXException { |
104 } | 122 } |