Statistics
| Revision:

root / tmp / org.txm.groovy.core / src / groovy / org / txm / scripts / importer / xml / pager.groovy @ 1688

History | View | Annotate | Download (12.5 kB)

1 321 mdecorde
// Copyright © 2010-2013 ENS de Lyon.
2 321 mdecorde
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
3 321 mdecorde
// Lyon 2, University of Franche-Comté, University of Nice
4 321 mdecorde
// Sophia Antipolis, University of Paris 3.
5 321 mdecorde
//
6 321 mdecorde
// The TXM platform is free software: you can redistribute it
7 321 mdecorde
// and/or modify it under the terms of the GNU General Public
8 321 mdecorde
// License as published by the Free Software Foundation,
9 321 mdecorde
// either version 2 of the License, or (at your option) any
10 321 mdecorde
// later version.
11 321 mdecorde
//
12 321 mdecorde
// The TXM platform is distributed in the hope that it will be
13 321 mdecorde
// useful, but WITHOUT ANY WARRANTY; without even the implied
14 321 mdecorde
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 321 mdecorde
// PURPOSE. See the GNU General Public License for more
16 321 mdecorde
// details.
17 321 mdecorde
//
18 321 mdecorde
// You should have received a copy of the GNU General
19 321 mdecorde
// Public License along with the TXM platform. If not, see
20 321 mdecorde
// http://www.gnu.org/licenses.
21 321 mdecorde
//
22 321 mdecorde
//
23 321 mdecorde
//
24 479 mdecorde
// $LastChangedDate: 2017-05-02 11:55:17 +0200 (mar. 02 mai 2017) $
25 479 mdecorde
// $LastChangedRevision: 3436 $
26 321 mdecorde
// $LastChangedBy: mdecorde $
27 321 mdecorde
//
28 986 mdecorde
package org.txm.scripts.importer.xml;
29 321 mdecorde
30 986 mdecorde
import org.txm.scripts.importer.*;
31 321 mdecorde
import org.xml.sax.Attributes;
32 1000 mdecorde
import org.txm.importer.scripts.filters.*;
33 321 mdecorde
import java.io.File;
34 321 mdecorde
import java.io.IOException;
35 321 mdecorde
import java.util.ArrayList;
36 321 mdecorde
import javax.xml.parsers.*
37 321 mdecorde
import javax.xml.stream.*;
38 321 mdecorde
import java.net.URL;
39 321 mdecorde
import org.xml.sax.InputSource;
40 321 mdecorde
import org.xml.sax.helpers.DefaultHandler;
41 625 mdecorde
import org.txm.utils.io.FileCopy
42 321 mdecorde
43 321 mdecorde
/** Build a simple edition from a xml-tei.
44 321 mdecorde
 * @author mdecorde */
45 321 mdecorde
class pager {
46 321 mdecorde
47 321 mdecorde
        List<String> NoSpaceBefore;
48 321 mdecorde
49 321 mdecorde
        /** The No space after. */
50 321 mdecorde
        List<String> NoSpaceAfter;
51 321 mdecorde
52 321 mdecorde
        /** The wordcount. */
53 321 mdecorde
        int wordcount = 0;
54 321 mdecorde
55 321 mdecorde
        /** The pagecount. */
56 321 mdecorde
        int pagecount = 0;
57 321 mdecorde
58 321 mdecorde
        /** The wordmax. */
59 321 mdecorde
        int wordmax = 0;
60 321 mdecorde
61 321 mdecorde
        /** The basename. */
62 321 mdecorde
        String basename = "";
63 321 mdecorde
        String txtname = "";
64 321 mdecorde
        File outdir;
65 321 mdecorde
66 321 mdecorde
        /** The wordid. */
67 321 mdecorde
        String wordid;
68 321 mdecorde
69 321 mdecorde
        /** The first word. */
70 321 mdecorde
        boolean firstWord = true;
71 321 mdecorde
72 321 mdecorde
        /** The wordvalue. */
73 321 mdecorde
        String wordvalue = "";
74 321 mdecorde
75 321 mdecorde
        /** The interpvalue. */
76 321 mdecorde
        String interpvalue = "";
77 321 mdecorde
78 321 mdecorde
        /** The lastword. */
79 321 mdecorde
        String lastword = " ";
80 321 mdecorde
81 321 mdecorde
        /** The wordtype. */
82 321 mdecorde
        String wordtype;
83 321 mdecorde
84 321 mdecorde
        /** The flagform. */
85 321 mdecorde
        boolean flagform = false;
86 321 mdecorde
87 321 mdecorde
        /** The flaginterp. */
88 321 mdecorde
        boolean flaginterp = false;
89 321 mdecorde
90 321 mdecorde
        /** The url. */
91 321 mdecorde
        private def url;
92 321 mdecorde
93 321 mdecorde
        /** The input data. */
94 321 mdecorde
        private def inputData;
95 321 mdecorde
96 321 mdecorde
        /** The factory. */
97 321 mdecorde
        private def factory;
98 321 mdecorde
99 321 mdecorde
        /** The parser. */
100 321 mdecorde
        private XMLStreamReader parser;
101 321 mdecorde
102 321 mdecorde
        /** The writer. */
103 321 mdecorde
        OutputStreamWriter writer;
104 321 mdecorde
105 321 mdecorde
        /** The pagedWriter. */
106 321 mdecorde
        StaxStackWriter pagedWriter = null;
107 321 mdecorde
108 321 mdecorde
        /** The infile. */
109 321 mdecorde
        File infile;
110 321 mdecorde
111 321 mdecorde
        /** The outfile. */
112 321 mdecorde
        File outfile;
113 321 mdecorde
114 321 mdecorde
        /** The pages. */
115 321 mdecorde
        ArrayList<File> pages = new ArrayList<File>();
116 321 mdecorde
117 321 mdecorde
        /** The idxstart. */
118 321 mdecorde
        ArrayList<String> idxstart = new ArrayList<String>();
119 321 mdecorde
        String paginationElement;
120 321 mdecorde
121 321 mdecorde
        /**
122 321 mdecorde
         * Instantiates a new pager.
123 321 mdecorde
         *
124 321 mdecorde
         * @param infile the infile
125 321 mdecorde
         * @param outfile the outfile
126 321 mdecorde
         * @param NoSpaceBefore the no space before
127 321 mdecorde
         * @param NoSpaceAfter the no space after
128 321 mdecorde
         * @param max the max
129 321 mdecorde
         * @param basename the basename
130 321 mdecorde
         */
131 321 mdecorde
        pager(File infile, File outdir, String txtname, List<String> NoSpaceBefore,
132 321 mdecorde
        List<String> NoSpaceAfter, int max, String basename, String paginationElement) {
133 321 mdecorde
                this.paginationElement = paginationElement;
134 321 mdecorde
                this.basename = basename;
135 321 mdecorde
                this.txtname = txtname;
136 321 mdecorde
                this.outdir = outdir;
137 321 mdecorde
                this.wordmax = max;
138 321 mdecorde
                this.NoSpaceBefore = NoSpaceBefore;
139 321 mdecorde
                this.NoSpaceAfter = NoSpaceAfter;
140 321 mdecorde
                this.url = infile.toURI().toURL();
141 321 mdecorde
                this.infile = infile;
142 321 mdecorde
143 321 mdecorde
                inputData = url.openStream();
144 321 mdecorde
                factory = XMLInputFactory.newInstance();
145 321 mdecorde
                parser = factory.createXMLStreamReader(inputData);
146 321 mdecorde
147 321 mdecorde
                process();
148 625 mdecorde
149 625 mdecorde
                // copy txm.css file near editions
150 625 mdecorde
                try {
151 625 mdecorde
                        File txmDir = infile.getParentFile().getParentFile();
152 625 mdecorde
                        if (txmDir.exists() && txmDir.getName().equals("txm")) {
153 625 mdecorde
                                File binDir = txmDir.getParentFile();
154 625 mdecorde
                                File corporaDir = binDir.getParentFile();
155 625 mdecorde
                                if (binDir.exists() && corporaDir.getName().equals("corpora")) {
156 625 mdecorde
                                        File htmlDir = new File(binDir, "HTML/"+basename.toUpperCase()+"/default")
157 625 mdecorde
                                        File txmhomeDir = corporaDir.getParentFile()
158 625 mdecorde
                                        File txmcss = new File(txmhomeDir, "css/txm.css")
159 625 mdecorde
                                        if (htmlDir.exists() && txmcss.exists()) {
160 625 mdecorde
                                                FileCopy.copy(txmcss, new File(htmlDir, "txm.css"))
161 625 mdecorde
                                        }
162 625 mdecorde
                                }
163 625 mdecorde
                        }
164 625 mdecorde
                } catch(Exception e) {
165 625 mdecorde
                        println "Failed to copy TXM default CSS: "+e.getLocalizedMessage();
166 625 mdecorde
                }
167 321 mdecorde
        }
168 321 mdecorde
169 321 mdecorde
        private def closeMultiWriter()
170 321 mdecorde
        {
171 321 mdecorde
                if (pagedWriter != null) {
172 321 mdecorde
                        def tags = pagedWriter.getTagStack().clone();
173 321 mdecorde
174 479 mdecorde
                        if (firstWord) { // there was no words found
175 321 mdecorde
                                pagedWriter.writeCharacters("");
176 321 mdecorde
                                this.idxstart.add("w_0")
177 321 mdecorde
                                pagedWriter.write("<span id=\"w_0\"/>");
178 321 mdecorde
                        }
179 321 mdecorde
                        pagedWriter.writeEndElements();
180 321 mdecorde
                        pagedWriter.close();
181 321 mdecorde
                        return tags;
182 321 mdecorde
                } else {
183 321 mdecorde
                        return [];
184 321 mdecorde
                }
185 321 mdecorde
        }
186 321 mdecorde
187 321 mdecorde
        /**
188 321 mdecorde
         * Creates the next output.
189 321 mdecorde
         *
190 321 mdecorde
         * @return true, if successful
191 321 mdecorde
         */
192 321 mdecorde
        private boolean createNextOutput() {
193 321 mdecorde
                wordcount = 0;
194 321 mdecorde
                try {
195 321 mdecorde
                        def tags = closeMultiWriter();
196 321 mdecorde
                        for (int i = 0 ; i < tags.size() ; i++) {
197 321 mdecorde
                                String tag = tags[i]
198 625 mdecorde
                                if ("div" != tag) {
199 321 mdecorde
                                        tags.remove(i--)
200 321 mdecorde
                                } else {
201 625 mdecorde
                                        tags.remove(i--) // remove first "div"
202 625 mdecorde
                                        break; // remove elements until first "div" tag
203 321 mdecorde
                                }
204 321 mdecorde
                        }
205 321 mdecorde
                        File outfile = new File(outdir, txtname+"_"+(++pagecount)+".html")
206 321 mdecorde
                        pages.add(outfile);
207 321 mdecorde
                        firstWord = true; // waiting for next word
208 321 mdecorde
209 321 mdecorde
                        pagedWriter = new StaxStackWriter(outfile, "UTF-8");
210 321 mdecorde
211 1064 mdecorde
                        //pagedWriter.writeStartDocument()
212 1064 mdecorde
                        pagedWriter.writeDTD("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">")
213 1064 mdecorde
                        pagedWriter.writeCharacters("\n")
214 321 mdecorde
                        pagedWriter.writeStartElement("html");
215 1064 mdecorde
                        pagedWriter.writeCharacters("\n")
216 321 mdecorde
                        pagedWriter.writeEmptyElement("meta", ["http-equiv":"Content-Type", "content":"text/html","charset":"UTF-8"]);
217 1064 mdecorde
                        pagedWriter.writeCharacters("\n")
218 321 mdecorde
                        pagedWriter.writeEmptyElement("link", ["rel":"stylesheet", "type":"text/css","href":"txm.css"]);
219 1064 mdecorde
                        pagedWriter.writeCharacters("\n")
220 321 mdecorde
                        pagedWriter.writeEmptyElement("link", ["rel":"stylesheet", "type":"text/css","href":"${basename}.css"]);
221 1064 mdecorde
                        pagedWriter.writeCharacters("\n")
222 321 mdecorde
                        pagedWriter.writeStartElement("head");
223 1064 mdecorde
                        pagedWriter.writeCharacters("\n")
224 321 mdecorde
                        pagedWriter.writeStartElement("title")
225 321 mdecorde
                        pagedWriter.writeCharacters(basename.toUpperCase()+" Edition - Page "+pagecount)
226 321 mdecorde
                        pagedWriter.writeEndElement(); // </title>
227 1064 mdecorde
                        pagedWriter.writeCharacters("\n")
228 321 mdecorde
                        pagedWriter.writeEndElement() // </head>
229 1064 mdecorde
                        pagedWriter.writeCharacters("\n")
230 321 mdecorde
                        pagedWriter.writeStartElement("body") //<body>
231 1064 mdecorde
                        pagedWriter.writeCharacters("\n")
232 625 mdecorde
                        pagedWriter.writeStartElement("div") //<div class="txmeditionpage">
233 625 mdecorde
                        pagedWriter.writeAttribute("class", "txmeditionpage")
234 625 mdecorde
235 321 mdecorde
                        pagedWriter.writeStartElements(tags);
236 321 mdecorde
                        return true;
237 321 mdecorde
                } catch (Exception e) {
238 479 mdecorde
                        System.out.println("Error: "+e.getLocalizedMessage());
239 321 mdecorde
                        return false;
240 321 mdecorde
                }
241 321 mdecorde
        }
242 321 mdecorde
243 321 mdecorde
        /**
244 321 mdecorde
         * Creates the output.
245 321 mdecorde
         *
246 321 mdecorde
         * @param outfile the outfile
247 321 mdecorde
         * @return true, if successful
248 321 mdecorde
         */
249 321 mdecorde
        private boolean createOutput() {
250 321 mdecorde
                try {
251 321 mdecorde
                        return createNextOutput();
252 321 mdecorde
                } catch (Exception e) {
253 321 mdecorde
                        System.out.println(e.getLocalizedMessage());
254 321 mdecorde
                        return false;
255 321 mdecorde
                }
256 321 mdecorde
        }
257 321 mdecorde
258 321 mdecorde
        /**
259 321 mdecorde
         * Gets the page files.
260 321 mdecorde
         *
261 321 mdecorde
         * @return the page files
262 321 mdecorde
         */
263 321 mdecorde
        public ArrayList<File> getPageFiles() {
264 321 mdecorde
                return pages;
265 321 mdecorde
        }
266 321 mdecorde
267 321 mdecorde
        /**
268 321 mdecorde
         * Gets the idx.
269 321 mdecorde
         *
270 321 mdecorde
         * @return the idx
271 321 mdecorde
         */
272 321 mdecorde
        public ArrayList<String> getIdx() {
273 321 mdecorde
                return idxstart;
274 321 mdecorde
        }
275 321 mdecorde
276 321 mdecorde
        /**
277 321 mdecorde
         * Process.
278 321 mdecorde
         */
279 321 mdecorde
        void process() {
280 321 mdecorde
                boolean flagNote = false;
281 321 mdecorde
                String noteContent = "";
282 321 mdecorde
283 321 mdecorde
                String localname = "";
284 321 mdecorde
                createNextOutput();
285 321 mdecorde
                for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
286 321 mdecorde
                        switch (event) {
287 321 mdecorde
                                case XMLStreamConstants.START_ELEMENT:
288 321 mdecorde
                                        localname = parser.getLocalName();
289 479 mdecorde
290 479 mdecorde
                                        if (localname == paginationElement) {
291 479 mdecorde
                                                createNextOutput();
292 479 mdecorde
                                                pagedWriter.write("\n");
293 479 mdecorde
                                                if (parser.getAttributeValue(null,"n") != null) {
294 479 mdecorde
                                                        pagedWriter.writeElement("p", ["style":"color:red", "align":"center"], "- "+parser.getAttributeValue(null,"n")+" -")
295 479 mdecorde
                                                }
296 479 mdecorde
                                        }
297 479 mdecorde
298 321 mdecorde
                                        switch (localname) {
299 321 mdecorde
                                                case "text":
300 321 mdecorde
                                                        pagedWriter.write("\n");
301 321 mdecorde
                                                        if (parser.getAttributeValue(null,"id") != null)
302 321 mdecorde
                                                                pagedWriter.writeElement("h3", parser.getAttributeValue(null,"id"))
303 321 mdecorde
                                                        pagedWriter.writeStartElement("table");
304 321 mdecorde
                                                        for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
305 321 mdecorde
                                                                pagedWriter.writeStartElement("tr");
306 321 mdecorde
                                                                pagedWriter.writeElement("td", parser.getAttributeLocalName(i));
307 321 mdecorde
                                                                pagedWriter.writeElement("td", parser.getAttributeValue(i).toString());
308 321 mdecorde
                                                                pagedWriter.writeEndElement();
309 321 mdecorde
                                                        }
310 321 mdecorde
                                                        pagedWriter.writeEndElement() // table
311 321 mdecorde
                                                        pagedWriter.writeEmptyElement("br")
312 321 mdecorde
                                                        pagedWriter.writeCharacters("");
313 321 mdecorde
                                                        break;
314 321 mdecorde
                                                case "note":
315 321 mdecorde
                                                        flagNote = true;
316 321 mdecorde
                                                        noteContent = ""
317 321 mdecorde
                                                        break;
318 321 mdecorde
                                                case "a":
319 321 mdecorde
                                                        pagedWriter.writeStartElement("a")
320 321 mdecorde
                                                        pagedWriter.writeAttribute("href", parser.getAttributeValue(null,"href"));
321 321 mdecorde
                                                        String target = parser.getAttributeValue(null,"target");
322 321 mdecorde
                                                        if (target == null) target = "_blank";
323 321 mdecorde
                                                        pagedWriter.writeAttribute("target", target);
324 321 mdecorde
                                                        break;
325 321 mdecorde
                                                case "head":
326 321 mdecorde
                                                        pagedWriter.write("\n");
327 321 mdecorde
                                                        pagedWriter.writeStartElement("h2")
328 321 mdecorde
                                                        break;
329 321 mdecorde
                                                case "graphic":
330 321 mdecorde
                                                        pagedWriter.write("\n");
331 321 mdecorde
                                                        String url = parser.getAttributeValue(null, "url")
332 321 mdecorde
                                                        if (url != null) {
333 321 mdecorde
                                                                pagedWriter.writeStartElement("div")
334 321 mdecorde
                                                                pagedWriter.writeEmptyElement("img", ["src":url])
335 321 mdecorde
                                                                pagedWriter.writeEndElement() // div
336 321 mdecorde
                                                        }
337 321 mdecorde
                                                        break;
338 321 mdecorde
                                                case "lg":
339 321 mdecorde
                                                case "p":
340 321 mdecorde
                                                case "q":
341 321 mdecorde
                                                        pagedWriter.write("\n");
342 321 mdecorde
                                                        String rend = parser.getAttributeValue(null, "rend")
343 321 mdecorde
                                                        if (rend == null) rend = "normal"
344 321 mdecorde
                                                        pagedWriter.writeStartElement("p",["class":rend])
345 321 mdecorde
                                                        break;
346 321 mdecorde
                                                //case "pb":
347 479 mdecorde
348 321 mdecorde
                                                case "lb":
349 321 mdecorde
                                                case "br":
350 321 mdecorde
                                                        pagedWriter.writeEmptyElement("br")
351 321 mdecorde
                                                        break;
352 321 mdecorde
                                                case "w":
353 479 mdecorde
354 321 mdecorde
                                                        wordid = parser.getAttributeValue(null,"id");
355 479 mdecorde
356 479 mdecorde
                                                        wordcount++;
357 479 mdecorde
                                                        if (wordcount >= wordmax) {
358 479 mdecorde
                                                                createNextOutput();
359 479 mdecorde
                                                        }
360 479 mdecorde
361 321 mdecorde
                                                        if (firstWord) {
362 321 mdecorde
                                                                firstWord = false;
363 321 mdecorde
                                                                this.idxstart.add(wordid);
364 321 mdecorde
                                                        }
365 479 mdecorde
366 321 mdecorde
                                                        break;
367 321 mdecorde
                                                case "ana":
368 321 mdecorde
                                                        flaginterp=true;
369 321 mdecorde
                                                        interpvalue+=" "+parser.getAttributeValue(null,"type").substring(1)+":"
370 321 mdecorde
                                                        break;
371 321 mdecorde
                                                case "form":
372 321 mdecorde
                                                        wordvalue="";
373 321 mdecorde
                                                        interpvalue ="";
374 321 mdecorde
                                                        flagform=true;
375 321 mdecorde
                                                        break;
376 321 mdecorde
                                                //                                                default:
377 321 mdecorde
                                                //                                                        pagedWriter.writeStartElement(localname)
378 321 mdecorde
                                        }
379 321 mdecorde
                                        break;
380 321 mdecorde
                                case XMLStreamConstants.END_ELEMENT:
381 321 mdecorde
                                        localname = parser.getLocalName();
382 321 mdecorde
                                        switch (localname) {
383 321 mdecorde
                                                case "head":
384 321 mdecorde
                                                        pagedWriter.writeEndElement() // </h2>
385 1064 mdecorde
                                                        pagedWriter.writeCharacters("\n")
386 321 mdecorde
                                                        break;
387 321 mdecorde
                                                case "note":
388 321 mdecorde
                                                        flagNote = false;
389 321 mdecorde
                                                        if (noteContent.length() > 0) {
390 321 mdecorde
                                                                pagedWriter.writeStartElement("span", ["style":"color:red;", "title":noteContent]);
391 321 mdecorde
                                                                pagedWriter.writeCharacters("[*]");
392 321 mdecorde
                                                                pagedWriter.writeEndElement() // </span>
393 321 mdecorde
                                                        }
394 321 mdecorde
                                                        break;
395 321 mdecorde
                                                case "lg":
396 321 mdecorde
                                                case "p":
397 321 mdecorde
                                                case "q":
398 321 mdecorde
                                                        pagedWriter.writeEndElement() // </p>
399 1064 mdecorde
                                                        pagedWriter.writeCharacters("\n")
400 321 mdecorde
                                                        break;
401 321 mdecorde
                                                case "a":
402 321 mdecorde
                                                        pagedWriter.writeEndElement() // </a>
403 321 mdecorde
                                                        break;
404 321 mdecorde
                                                case "form":
405 321 mdecorde
                                                        flagform = false
406 321 mdecorde
                                                        break;
407 321 mdecorde
                                                case "ana":
408 321 mdecorde
                                                        flaginterp = false
409 321 mdecorde
                                                        break;
410 321 mdecorde
                                                case "w":
411 321 mdecorde
                                                        int l = lastword.length();
412 321 mdecorde
                                                        String endOfLastWord = "";
413 321 mdecorde
                                                        if (l > 0)
414 321 mdecorde
                                                                endOfLastWord = lastword.subSequence(l-1, l);
415 321 mdecorde
416 321 mdecorde
                                                        if (interpvalue != null)
417 321 mdecorde
                                                                interpvalue = interpvalue;
418 321 mdecorde
419 321 mdecorde
                                                        if (NoSpaceBefore.contains(wordvalue) ||
420 321 mdecorde
                                                        NoSpaceAfter.contains(lastword) ||
421 321 mdecorde
                                                        wordvalue.startsWith("-") ||
422 321 mdecorde
                                                        NoSpaceAfter.contains(endOfLastWord)) {
423 321 mdecorde
                                                                pagedWriter.writeStartElement("span", ["title":interpvalue, "id":wordid]);
424 321 mdecorde
                                                        } else {
425 321 mdecorde
                                                                pagedWriter.writeCharacters(" ");
426 321 mdecorde
                                                                pagedWriter.writeStartElement("span", ["title":interpvalue, "id":wordid]);
427 321 mdecorde
                                                        }
428 321 mdecorde
429 321 mdecorde
                                                        pagedWriter.writeCharacters(wordvalue);
430 321 mdecorde
                                                        pagedWriter.writeEndElement();
431 1618 mdecorde
                                                        pagedWriter.writeComment("\n")
432 321 mdecorde
                                                        lastword=wordvalue;
433 321 mdecorde
                                                        break;
434 321 mdecorde
                                                //                                                default:
435 321 mdecorde
                                                //                                                        pagedWriter.writeEndElement()
436 321 mdecorde
                                        }
437 321 mdecorde
                                        break;
438 321 mdecorde
                                case XMLStreamConstants.CHARACTERS:
439 321 mdecorde
                                        if (flagform && parser.getText().length() > 0) {
440 321 mdecorde
                                                wordvalue+=(parser.getText());
441 321 mdecorde
                                                if (flagNote == parser.getText().length() > 0)
442 321 mdecorde
                                                        noteContent += parser.getText().replace("\n", " ");
443 321 mdecorde
                                        } else        if (flaginterp && parser.getText().length() > 0) {
444 321 mdecorde
                                                interpvalue+=(parser.getText());
445 321 mdecorde
                                        } else if (flagNote == parser.getText().length() > 0) {
446 321 mdecorde
                                                noteContent += parser.getText().replace("\n", " ");
447 321 mdecorde
                                        }
448 321 mdecorde
                                        break;
449 321 mdecorde
                        }
450 321 mdecorde
                }
451 321 mdecorde
                closeMultiWriter();
452 1688 mdecorde
                if (parser != null) parser.close();
453 1688 mdecorde
                if (inputData != null) inputData.close();
454 321 mdecorde
        }
455 321 mdecorde
}