Statistics
| Revision:

root / tmp / org.txm.groovy.core / src / groovy / org / txm / scripts / importer / tmx / 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 321 mdecorde
// $LastChangedDate: 2012-06-01 17:47:31 +0200 (ven., 01 juin 2012) $
25 321 mdecorde
// $LastChangedRevision: 2185 $
26 321 mdecorde
// $LastChangedBy: mdecorde $
27 321 mdecorde
//
28 986 mdecorde
package org.txm.scripts.importer.tmx;
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.SAXParserFactory;
37 321 mdecorde
import javax.xml.parsers.ParserConfigurationException;
38 321 mdecorde
import javax.xml.parsers.SAXParser;
39 321 mdecorde
import javax.xml.stream.*;
40 321 mdecorde
import java.net.URL;
41 321 mdecorde
import org.xml.sax.InputSource;
42 321 mdecorde
import org.xml.sax.helpers.DefaultHandler;
43 321 mdecorde
44 321 mdecorde
// TODO: Auto-generated Javadoc
45 321 mdecorde
/** Build GEO corpus simple edition from a xml-tei. @author mdecorde */
46 321 mdecorde
class pager {
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 multiwriter. */
106 321 mdecorde
        OutputStreamWriter multiwriter = 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 editionPage;
120 321 mdecorde
        ArrayList<Integer> splitTUs; // contains the tu ids used to split pages
121 321 mdecorde
        boolean shouldSplit = false;
122 321 mdecorde
        boolean useSplitTUs = false;
123 321 mdecorde
        /**
124 321 mdecorde
         * Instantiates a new pager.
125 321 mdecorde
         *
126 321 mdecorde
         * @param infile the infile
127 321 mdecorde
         * @param outfile the outfile
128 321 mdecorde
         * @param NoSpaceBefore the no space before
129 321 mdecorde
         * @param NoSpaceAfter the no space after
130 321 mdecorde
         * @param max the max
131 321 mdecorde
         * @param basename the basename
132 321 mdecorde
         */
133 321 mdecorde
        pager(File infile, File outdir, String txtname, List<String> NoSpaceBefore,
134 321 mdecorde
        List<String> NoSpaceAfter, int max, String basename, String editionPage, ArrayList<Integer> splitTUs) {
135 321 mdecorde
                this.editionPage = editionPage;
136 321 mdecorde
                this.basename = basename;
137 321 mdecorde
                this.txtname = txtname;
138 321 mdecorde
                this.outdir = outdir;
139 321 mdecorde
                this.wordmax = max;
140 321 mdecorde
                this.NoSpaceBefore = NoSpaceBefore;
141 321 mdecorde
                this.NoSpaceAfter = NoSpaceAfter;
142 321 mdecorde
                this.url = infile.toURI().toURL();
143 321 mdecorde
                this.infile = infile;
144 321 mdecorde
                this.splitTUs = splitTUs;
145 321 mdecorde
                //println "spliting pages with : "+splitTUs
146 321 mdecorde
                useSplitTUs = splitTUs.size() > 0;
147 321 mdecorde
                inputData = url.openStream();
148 321 mdecorde
                factory = XMLInputFactory.newInstance();
149 321 mdecorde
                parser = factory.createXMLStreamReader(inputData);
150 321 mdecorde
                process();
151 321 mdecorde
        }
152 321 mdecorde
153 321 mdecorde
        private void closeMultiWriter()
154 321 mdecorde
        {
155 321 mdecorde
                if (multiwriter != null) {
156 321 mdecorde
                        if (firstWord) { // there was no words
157 321 mdecorde
                                this.idxstart.add("w_0")
158 321 mdecorde
                                multiwriter.write("<span id=\"w_0\"/>");
159 321 mdecorde
                        }
160 321 mdecorde
                        multiwriter.write("</div>\n")
161 321 mdecorde
                        multiwriter.write("</body>");
162 321 mdecorde
                        multiwriter.write("</html>");
163 321 mdecorde
                        multiwriter.close();
164 321 mdecorde
                }
165 321 mdecorde
        }
166 321 mdecorde
167 321 mdecorde
        /**
168 321 mdecorde
         * Creates the next output.
169 321 mdecorde
         *
170 321 mdecorde
         * @return true, if successful
171 321 mdecorde
         */
172 321 mdecorde
        private boolean createNextOutput()
173 321 mdecorde
        {
174 321 mdecorde
                wordcount = 0;
175 321 mdecorde
                shouldSplit = false;
176 321 mdecorde
                try {
177 321 mdecorde
                        closeMultiWriter();
178 321 mdecorde
                        File outfile = new File(outdir, txtname+"_"+(++pagecount)+".html")
179 321 mdecorde
                        pages.add(outfile);
180 321 mdecorde
                        firstWord = true; // waiting for next word
181 321 mdecorde
182 321 mdecorde
                        multiwriter = new OutputStreamWriter(new FileOutputStream(outfile) , "UTF-8");
183 321 mdecorde
184 321 mdecorde
                        multiwriter.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
185 321 mdecorde
                        multiwriter.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"   \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n")
186 321 mdecorde
                        multiwriter.write("<html>");
187 321 mdecorde
                        multiwriter.write("<head>");
188 321 mdecorde
                        multiwriter.write("<title>"+basename.toUpperCase()+" $txtname Edition - Page "+pagecount+"</title>");
189 321 mdecorde
                        multiwriter.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"tmx.css\"/>");
190 321 mdecorde
                        multiwriter.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\"/>");
191 321 mdecorde
                        multiwriter.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>");
192 321 mdecorde
                        multiwriter.write("</head>");
193 321 mdecorde
                        multiwriter.write("<body>");
194 321 mdecorde
                        multiwriter.write("<div class=\"tmx\">\n")
195 321 mdecorde
196 321 mdecorde
                        return true;
197 321 mdecorde
                } catch (Exception e) {
198 321 mdecorde
                        System.out.println(e.getLocalizedMessage());
199 321 mdecorde
                        return false;
200 321 mdecorde
                }
201 321 mdecorde
        }
202 321 mdecorde
203 321 mdecorde
        /**
204 321 mdecorde
         * Creates the output.
205 321 mdecorde
         *
206 321 mdecorde
         * @param outfile the outfile
207 321 mdecorde
         * @return true, if successful
208 321 mdecorde
         */
209 321 mdecorde
        private boolean createOutput() {
210 321 mdecorde
                try {
211 321 mdecorde
                        return createNextOutput();
212 321 mdecorde
                } catch (Exception e) {
213 321 mdecorde
                        System.out.println(e.getLocalizedMessage());
214 321 mdecorde
                        return false;
215 321 mdecorde
                }
216 321 mdecorde
        }
217 321 mdecorde
218 321 mdecorde
        /**
219 321 mdecorde
         * Gets the page files.
220 321 mdecorde
         *
221 321 mdecorde
         * @return the page files
222 321 mdecorde
         */
223 321 mdecorde
        public ArrayList<File> getPageFiles() {
224 321 mdecorde
                return pages;
225 321 mdecorde
        }
226 321 mdecorde
227 321 mdecorde
        /**
228 321 mdecorde
         * Gets the idx.
229 321 mdecorde
         *
230 321 mdecorde
         * @return the idx
231 321 mdecorde
         */
232 321 mdecorde
        public ArrayList<String> getIdx() {
233 321 mdecorde
                return idxstart;
234 321 mdecorde
        }
235 321 mdecorde
236 321 mdecorde
        /**
237 321 mdecorde
         * Process.
238 321 mdecorde
         */
239 321 mdecorde
        void process() {
240 321 mdecorde
241 321 mdecorde
                String vNote = ""
242 321 mdecorde
                String cssNote = "note"
243 321 mdecorde
                boolean flagNote = false;
244 321 mdecorde
245 321 mdecorde
                String tuCSS = "tu"
246 321 mdecorde
247 321 mdecorde
                int tuCounter = 0;
248 321 mdecorde
                String localname = "";
249 321 mdecorde
                createNextOutput();
250 321 mdecorde
                for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
251 321 mdecorde
                        switch (event) {
252 321 mdecorde
                                case XMLStreamConstants.START_ELEMENT:
253 321 mdecorde
                                        localname = parser.getLocalName();
254 321 mdecorde
                                        switch (localname) {
255 321 mdecorde
                                                case "text":
256 321 mdecorde
                                                        boolean grey = "true"
257 321 mdecorde
                                                        String title = txtname;
258 321 mdecorde
                                                        String subtitle = "";
259 321 mdecorde
                                                        String author = "";
260 321 mdecorde
                                                        String translator = "";
261 321 mdecorde
                                                        String table = "";
262 321 mdecorde
                                                        table += ("<table>\n");
263 321 mdecorde
                                                        for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
264 321 mdecorde
                                                                String name = parser.getAttributeLocalName(i);
265 321 mdecorde
                                                                grey = !grey;
266 321 mdecorde
                                                                if (grey) table += ("<tr  style=\"background-color:lightgrey;\">");
267 321 mdecorde
                                                                else table += ("<tr>");
268 321 mdecorde
269 321 mdecorde
                                                                table += ("<td>"+parser.getAttributeLocalName(i)+": </td>");
270 321 mdecorde
                                                                table += ("<td>"+parser.getAttributeValue(i)+"</td>");
271 321 mdecorde
                                                                table += ("</tr>\n");
272 321 mdecorde
273 321 mdecorde
                                                                if (name == "title") title = parser.getAttributeValue(i);
274 321 mdecorde
                                                                else if (name == "subtitle") subtitle = parser.getAttributeValue(i);
275 321 mdecorde
                                                                else if (name == "author") author = parser.getAttributeValue(i);
276 321 mdecorde
                                                                else if (name == "translator") translator = parser.getAttributeValue(i);
277 321 mdecorde
                                                        }
278 321 mdecorde
                                                        multiwriter.write("<div class=\"header\">")
279 321 mdecorde
                                                        multiwriter.write("<span class=\"authorStyle\"> "+author+" </span>")
280 321 mdecorde
                                                        multiwriter.write("<span class=\"titleStyle\"> "+title+" </span>")
281 321 mdecorde
                                                        multiwriter.write("<span class=\"subtitleStyle\"> "+subtitle+" </span>")
282 321 mdecorde
                                                        if (translator.size() > 0)
283 321 mdecorde
                                                                multiwriter.write("<span class=\"translatorStyle\"> "+translator+" </span>")
284 321 mdecorde
                                                        multiwriter.write("</div>")
285 321 mdecorde
//                                                        multiwriter.write(table)
286 321 mdecorde
//                                                        multiwriter.write("</table><br/>\n");
287 321 mdecorde
                                                        break;
288 321 mdecorde
                                                case "head":
289 321 mdecorde
                                                        multiwriter.write("<h2>\n")
290 321 mdecorde
                                                        break;
291 321 mdecorde
                                                case "graphic":
292 321 mdecorde
                                                        String url = parser.getAttributeValue(null, "url")
293 321 mdecorde
                                                //println "URL: "+url
294 321 mdecorde
                                                        if (url != null) multiwriter.write("<div><img src=\"$url\"/></div>");
295 321 mdecorde
                                                        break;
296 321 mdecorde
                                                case "lg":
297 321 mdecorde
                                                case "p":
298 321 mdecorde
                                                case "q":
299 321 mdecorde
                                                        String rend = parser.getAttributeValue(null, "rend")
300 321 mdecorde
                                                        if (rend == null) rend = "normal"
301 321 mdecorde
                                                        multiwriter.write("<p class=\"$rend\">\n")
302 321 mdecorde
                                                        break;
303 321 mdecorde
                                                //case "pb":
304 321 mdecorde
                                                case editionPage:
305 321 mdecorde
                                                        createNextOutput();
306 321 mdecorde
                                                        wordcount=0;
307 321 mdecorde
                                                        if (parser.getAttributeValue(null,"n") != null) {
308 321 mdecorde
                                                                multiwriter.write("<p style=\"color:red\" align=\"center\">- "+parser.getAttributeValue(null,"n")+" -</p>\n")
309 321 mdecorde
                                                        }
310 321 mdecorde
                                                        break;
311 321 mdecorde
                                                case "lb":
312 321 mdecorde
                                                case "br":
313 321 mdecorde
                                                        multiwriter.write("<br/>\n")
314 321 mdecorde
                                                        break;
315 321 mdecorde
                                                case "tu":
316 321 mdecorde
                                                        tuCounter++;
317 321 mdecorde
                                                        if (useSplitTUs) {
318 321 mdecorde
                                                                if (splitTUs.contains(tuCounter))
319 321 mdecorde
                                                                        createNextOutput();
320 321 mdecorde
                                                        } else if (shouldSplit) {
321 321 mdecorde
                                                                createNextOutput();
322 321 mdecorde
                                                                this.splitTUs << tuCounter
323 321 mdecorde
                                                        }
324 321 mdecorde
                                                        String str = "";
325 321 mdecorde
                                                        String title;
326 321 mdecorde
                                                        tuCSS = "tu"
327 321 mdecorde
                                                        for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
328 321 mdecorde
                                                                str += " "+parser.getAttributeLocalName(i)+"="+parser.getAttributeValue(i)
329 321 mdecorde
                                                                if (parser.getAttributeLocalName(i).equals("cssClass")) {
330 321 mdecorde
                                                                        tuCSS = parser.getAttributeValue(i)
331 321 mdecorde
                                                                } else if (parser.getAttributeLocalName(i).equals("title")) {
332 321 mdecorde
                                                                        title = parser.getAttributeValue(i)
333 321 mdecorde
                                                                }
334 321 mdecorde
                                                        }
335 321 mdecorde
                                                        if (title != null) str = title;
336 321 mdecorde
                                                        multiwriter.write("<h5 class=\"${tuCSS}Title\">$str</h5>\n")
337 321 mdecorde
                                                        break;
338 321 mdecorde
                                                case "note":
339 321 mdecorde
                                                cssNote = "note"
340 321 mdecorde
                                                for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
341 321 mdecorde
                                                        if (parser.getAttributeLocalName(i) == "cssClass") {
342 321 mdecorde
                                                                cssNote = parser.getAttributeValue(i)
343 321 mdecorde
                                                                break
344 321 mdecorde
                                                        }
345 321 mdecorde
                                                }
346 321 mdecorde
                                                        vNote = "";
347 321 mdecorde
                                                        flagNote = true;
348 321 mdecorde
                                                        break;
349 321 mdecorde
                                                case "seg":
350 321 mdecorde
                                                String css = "seg"
351 321 mdecorde
                                                        if (tuCSS != "tu") css = tuCSS;
352 321 mdecorde
                                                        multiwriter.write("<p class=\"${css}\">\n");
353 321 mdecorde
                                                        break;
354 321 mdecorde
                                                case "w":
355 321 mdecorde
                                                        wordid = parser.getAttributeValue(null,"id");
356 321 mdecorde
357 321 mdecorde
                                                        wordcount++;
358 321 mdecorde
                                                        if (wordcount >= wordmax) {
359 321 mdecorde
                                                                //createNextOutput();
360 321 mdecorde
                                                                shouldSplit = true;
361 321 mdecorde
                                                                //println "should split: "+wordcount
362 321 mdecorde
                                                        }
363 479 mdecorde
364 479 mdecorde
                                                        if (firstWord) {
365 479 mdecorde
                                                                firstWord = false;
366 479 mdecorde
                                                                this.idxstart.add(wordid);
367 479 mdecorde
                                                        }
368 479 mdecorde
369 321 mdecorde
                                                        break;
370 321 mdecorde
371 321 mdecorde
                                                case "ana":
372 321 mdecorde
                                                        flaginterp=true;
373 321 mdecorde
                                                        interpvalue+=" "+parser.getAttributeValue(null,"type").substring(1)+":"
374 321 mdecorde
                                                        break;
375 321 mdecorde
376 321 mdecorde
                                                case "form":
377 321 mdecorde
                                                        wordvalue="";
378 321 mdecorde
                                                        interpvalue ="";
379 321 mdecorde
                                                        flagform=true;
380 321 mdecorde
                                        }
381 321 mdecorde
                                        break;
382 321 mdecorde
                                case XMLStreamConstants.END_ELEMENT:
383 321 mdecorde
                                        localname = parser.getLocalName();
384 321 mdecorde
                                        switch (localname) {
385 321 mdecorde
                                                case "head":
386 321 mdecorde
                                                        multiwriter.write("</h2>\n")
387 321 mdecorde
                                                        break;
388 321 mdecorde
                                                case "lg":
389 321 mdecorde
                                                case "p":
390 321 mdecorde
                                                case "q":
391 321 mdecorde
                                                        multiwriter.write("</p>\n")
392 321 mdecorde
                                                        break;
393 321 mdecorde
394 321 mdecorde
                                                case "seg":
395 321 mdecorde
                                                        multiwriter.write("</p>\n");
396 321 mdecorde
                                                        break;
397 321 mdecorde
                                                case "note":
398 321 mdecorde
                                                        flagNote = false;
399 321 mdecorde
                                                        multiwriter.write("<div class=\"${cssNote}\">${vNote}</div>")
400 321 mdecorde
                                                        break;
401 321 mdecorde
402 321 mdecorde
                                                case "form":
403 321 mdecorde
                                                        flagform = false
404 321 mdecorde
                                                        break;
405 321 mdecorde
                                                case "ana":
406 321 mdecorde
                                                        flaginterp = false
407 321 mdecorde
                                                        break;
408 321 mdecorde
                                                case "w":
409 321 mdecorde
410 321 mdecorde
                                                        int l = lastword.length();
411 321 mdecorde
                                                        String endOfLastWord = "";
412 321 mdecorde
                                                        if (l > 0)
413 321 mdecorde
                                                                endOfLastWord = lastword.subSequence(l-1, l);
414 321 mdecorde
415 321 mdecorde
                                                        if (interpvalue != null)
416 321 mdecorde
                                                                interpvalue = interpvalue.replace("&", "&amp;").replace("<", "&lt;").replace("\"","&quot;");
417 321 mdecorde
418 321 mdecorde
                                                        if (NoSpaceBefore.contains(wordvalue) ||
419 321 mdecorde
                                                        NoSpaceAfter.contains(lastword) ||
420 321 mdecorde
                                                        wordvalue.startsWith("-") ||
421 321 mdecorde
                                                        NoSpaceAfter.contains(endOfLastWord)) {
422 321 mdecorde
                                                                multiwriter.write("<span title=\""+interpvalue+"\" id=\""+wordid+"\">");
423 321 mdecorde
                                                        } else {
424 321 mdecorde
                                                                multiwriter.write(" <span title=\""+interpvalue+"\" id=\""+wordid+"\">");
425 321 mdecorde
                                                        }
426 321 mdecorde
                                                //writer.write(wordvalue.replace("&", "&amp;").replace("\"","&quot;").replace("<", "&lt;")+"</span>");
427 321 mdecorde
                                                        multiwriter.write(wordvalue.replace("&", "&amp;").replace("\"","&quot;").replace("<", "&lt;")+"</span>");
428 321 mdecorde
                                                        lastword=wordvalue;
429 321 mdecorde
                                                        break;
430 321 mdecorde
                                        }
431 321 mdecorde
                                        break;
432 321 mdecorde
433 321 mdecorde
                                case XMLStreamConstants.CHARACTERS:
434 321 mdecorde
                                        if (flagform)
435 321 mdecorde
                                                if (parser.getText().length() > 0)
436 321 mdecorde
                                                        wordvalue+=(parser.getText());
437 321 mdecorde
                                        if (flaginterp)
438 321 mdecorde
                                                if (parser.getText().length() > 0)
439 321 mdecorde
                                                        interpvalue+=(parser.getText());
440 321 mdecorde
                                        if (flagNote)
441 321 mdecorde
                                                if (parser.getText().length() > 0)
442 321 mdecorde
                                                        vNote+=(parser.getText());
443 321 mdecorde
                                        break;
444 321 mdecorde
                        }
445 321 mdecorde
                }
446 321 mdecorde
                //writer.write("</body>");
447 321 mdecorde
                //writer.write("</html>");
448 321 mdecorde
                //writer.close();
449 321 mdecorde
                closeMultiWriter();
450 1688 mdecorde
                if (parser != null) parser.close();
451 1688 mdecorde
                if (inputData != null) inputData.close();
452 321 mdecorde
        }
453 321 mdecorde
}