1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| |
6 |
| |
7 |
| |
8 |
| |
9 |
| |
10 |
| |
11 |
| |
12 |
| |
13 |
| |
14 |
| |
15 |
| |
16 |
| |
17 |
| |
18 |
| |
19 |
| |
20 |
| |
21 |
| |
22 |
| |
23 |
| |
24 |
| |
25 |
| |
26 |
| |
27 |
| |
28 |
| |
29 |
| |
30 |
| |
31 |
| |
32 |
| |
33 |
| |
34 |
| |
35 |
| |
36 |
| |
37 |
| |
38 |
| |
39 |
| |
40 |
| |
41 |
| |
42 |
| |
43 |
| |
44 |
| |
45 |
| |
46 |
| |
47 |
| |
48 |
| |
49 |
| |
50 |
| |
51 |
| |
52 |
| |
53 |
| |
54 |
| package org.w3c.tidy; |
55 |
| |
56 |
| import java.io.FileInputStream; |
57 |
| import java.io.FileNotFoundException; |
58 |
| import java.io.FileOutputStream; |
59 |
| import java.io.FileWriter; |
60 |
| import java.io.IOException; |
61 |
| import java.io.InputStream; |
62 |
| import java.io.OutputStream; |
63 |
| import java.io.PrintWriter; |
64 |
| import java.io.Serializable; |
65 |
| import java.util.HashMap; |
66 |
| import java.util.Map; |
67 |
| import java.util.Properties; |
68 |
| |
69 |
| |
70 |
| |
71 |
| |
72 |
| |
73 |
| |
74 |
| |
75 |
| |
76 |
| |
77 |
| public class Tidy implements Serializable |
78 |
| { |
79 |
| |
80 |
| |
81 |
| |
82 |
| |
83 |
| static final long serialVersionUID = -2794371560623987718L; |
84 |
| |
85 |
| |
86 |
| |
87 |
| |
88 |
| private static final Map CMDLINE_ALIAS = new HashMap(); |
89 |
| |
90 |
| static |
91 |
| { |
92 |
11
| CMDLINE_ALIAS.put("xml", "input-xml");
|
93 |
11
| CMDLINE_ALIAS.put("xml", "output-xhtml");
|
94 |
11
| CMDLINE_ALIAS.put("asxml", "output-xhtml");
|
95 |
11
| CMDLINE_ALIAS.put("ashtml", "output-html");
|
96 |
11
| CMDLINE_ALIAS.put("omit", "hide-endtags");
|
97 |
11
| CMDLINE_ALIAS.put("upper", "uppercase-tags");
|
98 |
11
| CMDLINE_ALIAS.put("raw", "output-raw");
|
99 |
11
| CMDLINE_ALIAS.put("numeric", "numeric-entities");
|
100 |
11
| CMDLINE_ALIAS.put("change", "write-back");
|
101 |
11
| CMDLINE_ALIAS.put("update", "write-back");
|
102 |
11
| CMDLINE_ALIAS.put("modify", "write-back");
|
103 |
11
| CMDLINE_ALIAS.put("errors", "only-errors");
|
104 |
11
| CMDLINE_ALIAS.put("slides", "split");
|
105 |
11
| CMDLINE_ALIAS.put("lang", "language");
|
106 |
11
| CMDLINE_ALIAS.put("w", "wrap");
|
107 |
11
| CMDLINE_ALIAS.put("file", "error-file");
|
108 |
11
| CMDLINE_ALIAS.put("f", "error-file");
|
109 |
| } |
110 |
| |
111 |
| |
112 |
| |
113 |
| |
114 |
| private PrintWriter errout; |
115 |
| |
116 |
| private PrintWriter stderr; |
117 |
| |
118 |
| private Configuration configuration; |
119 |
| |
120 |
| private String inputStreamName = "InputStream"; |
121 |
| |
122 |
| private int parseErrors; |
123 |
| |
124 |
| private int parseWarnings; |
125 |
| |
126 |
| private Report report; |
127 |
| |
128 |
| |
129 |
| |
130 |
| |
131 |
239
| public Tidy()
|
132 |
| { |
133 |
239
| this.report = new Report();
|
134 |
239
| configuration = new Configuration(this.report);
|
135 |
239
| if (configuration == null)
|
136 |
| { |
137 |
0
| return;
|
138 |
| } |
139 |
| |
140 |
239
| AttributeTable at = AttributeTable.getDefaultAttributeTable();
|
141 |
239
| if (at == null)
|
142 |
| { |
143 |
0
| return;
|
144 |
| } |
145 |
239
| TagTable tt = new TagTable();
|
146 |
239
| if (tt == null)
|
147 |
| { |
148 |
0
| return;
|
149 |
| } |
150 |
239
| tt.setConfiguration(configuration);
|
151 |
239
| configuration.tt = tt;
|
152 |
239
| EntityTable et = EntityTable.getDefaultEntityTable();
|
153 |
239
| if (et == null)
|
154 |
| { |
155 |
0
| return;
|
156 |
| } |
157 |
| |
158 |
239
| configuration.errfile = null;
|
159 |
239
| stderr = new PrintWriter(System.err, true);
|
160 |
239
| errout = stderr;
|
161 |
| } |
162 |
| |
163 |
| |
164 |
| |
165 |
| |
166 |
| |
167 |
153
| public Configuration getConfiguration()
|
168 |
| { |
169 |
153
| return configuration;
|
170 |
| } |
171 |
| |
172 |
0
| public PrintWriter getStderr()
|
173 |
| { |
174 |
0
| return stderr;
|
175 |
| } |
176 |
| |
177 |
| |
178 |
| |
179 |
| |
180 |
| |
181 |
22
| public int getParseErrors()
|
182 |
| { |
183 |
22
| return parseErrors;
|
184 |
| } |
185 |
| |
186 |
| |
187 |
| |
188 |
| |
189 |
| |
190 |
31
| public int getParseWarnings()
|
191 |
| { |
192 |
31
| return parseWarnings;
|
193 |
| } |
194 |
| |
195 |
| |
196 |
| |
197 |
| |
198 |
| |
199 |
0
| public void setInputStreamName(String name)
|
200 |
| { |
201 |
0
| if (name != null)
|
202 |
| { |
203 |
0
| inputStreamName = name;
|
204 |
| } |
205 |
| } |
206 |
| |
207 |
0
| public String getInputStreamName()
|
208 |
| { |
209 |
0
| return inputStreamName;
|
210 |
| } |
211 |
| |
212 |
| |
213 |
| |
214 |
| |
215 |
| |
216 |
0
| public PrintWriter getErrout()
|
217 |
| { |
218 |
0
| return errout;
|
219 |
| } |
220 |
| |
221 |
229
| public void setErrout(PrintWriter out)
|
222 |
| { |
223 |
229
| this.errout = out;
|
224 |
| } |
225 |
| |
226 |
| |
227 |
| |
228 |
| |
229 |
| |
230 |
0
| public void setConfigurationFromFile(String filename)
|
231 |
| { |
232 |
0
| configuration.parseFile(filename);
|
233 |
| } |
234 |
| |
235 |
| |
236 |
| |
237 |
| |
238 |
| |
239 |
229
| public void setConfigurationFromProps(Properties props)
|
240 |
| { |
241 |
229
| configuration.addProps(props);
|
242 |
| } |
243 |
| |
244 |
| |
245 |
| |
246 |
| |
247 |
| |
248 |
| |
249 |
| |
250 |
234
| public Node parse(InputStream in, OutputStream out)
|
251 |
| { |
252 |
234
| Node document = null;
|
253 |
| |
254 |
234
| try
|
255 |
| { |
256 |
234
| document = parse(in, null, out);
|
257 |
| } |
258 |
| catch (FileNotFoundException fnfe) |
259 |
| { |
260 |
| |
261 |
| } |
262 |
| catch (IOException e) |
263 |
| { |
264 |
| |
265 |
| } |
266 |
| |
267 |
234
| return document;
|
268 |
| } |
269 |
| |
270 |
| |
271 |
| |
272 |
| |
273 |
| |
274 |
| |
275 |
| |
276 |
| |
277 |
| |
278 |
| |
279 |
| |
280 |
235
| private Node parse(InputStream in, String file, OutputStream out) throws FileNotFoundException, IOException
|
281 |
| { |
282 |
235
| Lexer lexer;
|
283 |
235
| Node document = null;
|
284 |
235
| Node doctype;
|
285 |
235
| PPrint pprint;
|
286 |
| |
287 |
235
| if (errout == null)
|
288 |
| { |
289 |
0
| return null;
|
290 |
| } |
291 |
| |
292 |
235
| parseErrors = 0;
|
293 |
235
| parseWarnings = 0;
|
294 |
| |
295 |
| |
296 |
235
| configuration.adjust();
|
297 |
| |
298 |
235
| if (file != null)
|
299 |
| { |
300 |
1
| in = new FileInputStream(file);
|
301 |
1
| inputStreamName = file;
|
302 |
| } |
303 |
234
| else if (in == null)
|
304 |
| { |
305 |
0
| in = System.in;
|
306 |
0
| inputStreamName = "stdin";
|
307 |
| } |
308 |
| |
309 |
235
| if (in != null)
|
310 |
| { |
311 |
| |
312 |
235
| StreamIn streamIn = StreamInFactory.getStreamIn(configuration, in);
|
313 |
| |
314 |
235
| lexer = new Lexer(streamIn, configuration, this.report);
|
315 |
235
| lexer.errout = errout;
|
316 |
| |
317 |
| |
318 |
235
| streamIn.setLexer(lexer);
|
319 |
| |
320 |
235
| this.report.setFilename(inputStreamName);
|
321 |
| |
322 |
235
| if (!configuration.quiet)
|
323 |
| { |
324 |
230
| this.report.helloMessage(errout);
|
325 |
| } |
326 |
| |
327 |
| |
328 |
| |
329 |
| |
330 |
| |
331 |
| |
332 |
| |
333 |
| |
334 |
| |
335 |
| |
336 |
| |
337 |
| |
338 |
| |
339 |
| |
340 |
| |
341 |
| |
342 |
235
| if (configuration.xmlTags)
|
343 |
| { |
344 |
17
| document = ParserImpl.parseXMLDocument(lexer);
|
345 |
17
| if (!document.checkNodeIntegrity())
|
346 |
| { |
347 |
0
| if (!configuration.quiet)
|
348 |
| { |
349 |
0
| report.badTree(errout);
|
350 |
| } |
351 |
0
| return null;
|
352 |
| } |
353 |
| } |
354 |
| else |
355 |
| { |
356 |
218
| lexer.warnings = 0;
|
357 |
| |
358 |
218
| document = ParserImpl.parseDocument(lexer);
|
359 |
| |
360 |
218
| if (!document.checkNodeIntegrity())
|
361 |
| { |
362 |
2
| if (!configuration.quiet)
|
363 |
| { |
364 |
2
| this.report.badTree(errout);
|
365 |
| } |
366 |
2
| return null;
|
367 |
| } |
368 |
| |
369 |
216
| Clean cleaner = new Clean(configuration.tt);
|
370 |
| |
371 |
| |
372 |
216
| cleaner.nestedEmphasis(document);
|
373 |
| |
374 |
| |
375 |
216
| cleaner.list2BQ(document);
|
376 |
216
| cleaner.bQ2Div(document);
|
377 |
| |
378 |
| |
379 |
216
| if (configuration.logicalEmphasis)
|
380 |
| { |
381 |
9
| cleaner.emFromI(document);
|
382 |
| } |
383 |
| |
384 |
216
| if (configuration.word2000 && cleaner.isWord2000(document))
|
385 |
| { |
386 |
| |
387 |
5
| cleaner.dropSections(lexer, document);
|
388 |
| |
389 |
| |
390 |
5
| cleaner.cleanWord2000(lexer, document);
|
391 |
| } |
392 |
| |
393 |
| |
394 |
216
| if (configuration.makeClean || configuration.dropFontTags)
|
395 |
| { |
396 |
17
| cleaner.cleanTree(lexer, document);
|
397 |
| } |
398 |
| |
399 |
216
| if (!document.checkNodeIntegrity())
|
400 |
| { |
401 |
0
| this.report.badTree(errout);
|
402 |
0
| return null;
|
403 |
| } |
404 |
| |
405 |
216
| doctype = document.findDocType();
|
406 |
| |
407 |
| |
408 |
216
| if (doctype != null)
|
409 |
| { |
410 |
114
| doctype = (Node) doctype.clone();
|
411 |
| } |
412 |
| |
413 |
216
| if (document.content != null)
|
414 |
| { |
415 |
216
| if (configuration.xHTML)
|
416 |
| { |
417 |
78
| lexer.setXHTMLDocType(document);
|
418 |
| } |
419 |
| else |
420 |
| { |
421 |
138
| lexer.fixDocType(document);
|
422 |
| } |
423 |
| |
424 |
216
| if (configuration.tidyMark)
|
425 |
| { |
426 |
15
| lexer.addGenerator(document);
|
427 |
| } |
428 |
| } |
429 |
| |
430 |
| |
431 |
216
| if (configuration.xmlOut && configuration.xmlPi)
|
432 |
| { |
433 |
13
| lexer.fixXmlDecl(document);
|
434 |
| } |
435 |
| |
436 |
216
| if (!configuration.quiet && document.content != null)
|
437 |
| { |
438 |
211
| this.report.reportVersion(errout, lexer, inputStreamName, doctype);
|
439 |
| } |
440 |
| } |
441 |
| |
442 |
| |
443 |
233
| if ((file != null) && (in != System.in))
|
444 |
| { |
445 |
1
| try
|
446 |
| { |
447 |
1
| in.close();
|
448 |
| } |
449 |
| catch (IOException e) |
450 |
| { |
451 |
| |
452 |
| } |
453 |
| } |
454 |
| |
455 |
233
| if (!configuration.quiet)
|
456 |
| { |
457 |
228
| parseWarnings = lexer.warnings;
|
458 |
228
| parseErrors = lexer.errors;
|
459 |
228
| this.report.reportNumWarnings(errout, lexer);
|
460 |
| } |
461 |
| |
462 |
233
| if (!configuration.quiet && lexer.errors > 0 && !configuration.forceOutput)
|
463 |
| { |
464 |
14
| this.report.needsAuthorIntervention(errout);
|
465 |
| } |
466 |
| |
467 |
233
| if (!configuration.onlyErrors && (lexer.errors == 0 || configuration.forceOutput))
|
468 |
| { |
469 |
217
| if (configuration.burstSlides)
|
470 |
| { |
471 |
1
| Node body;
|
472 |
| |
473 |
1
| body = null;
|
474 |
| |
475 |
| |
476 |
| |
477 |
1
| doctype = document.findDocType();
|
478 |
| |
479 |
1
| if (doctype != null)
|
480 |
| { |
481 |
1
| Node.discardElement(doctype);
|
482 |
| } |
483 |
| |
484 |
| |
485 |
1
| lexer.versions |= Dict.VERS_HTML40_LOOSE;
|
486 |
| |
487 |
| |
488 |
1
| if (configuration.xHTML)
|
489 |
| { |
490 |
0
| lexer.setXHTMLDocType(document);
|
491 |
| } |
492 |
| else |
493 |
| { |
494 |
1
| lexer.fixDocType(document);
|
495 |
| } |
496 |
| |
497 |
| |
498 |
1
| body = document.findBody(configuration.tt);
|
499 |
| |
500 |
1
| if (body != null)
|
501 |
| { |
502 |
1
| pprint = new PPrint(configuration);
|
503 |
1
| if (!configuration.quiet)
|
504 |
| { |
505 |
1
| this.report.reportNumberOfSlides(errout, pprint.countSlides(body));
|
506 |
| } |
507 |
1
| pprint.createSlides(lexer, document);
|
508 |
| } |
509 |
0
| else if (!configuration.quiet)
|
510 |
| { |
511 |
0
| this.report.missingBody(errout);
|
512 |
| } |
513 |
| } |
514 |
216
| else if (configuration.writeback && (file != null))
|
515 |
| { |
516 |
0
| try
|
517 |
| { |
518 |
0
| pprint = new PPrint(configuration);
|
519 |
0
| FileOutputStream fis = new FileOutputStream(file);
|
520 |
| |
521 |
0
| Out o = OutFactory.getOut(this.configuration, fis);
|
522 |
| |
523 |
0
| if (document.findDocType() == null)
|
524 |
| { |
525 |
| |
526 |
| |
527 |
0
| configuration.numEntities = true;
|
528 |
| } |
529 |
0
| if (configuration.bodyOnly)
|
530 |
| { |
531 |
| |
532 |
0
| pprint.printBody(o, lexer, document, configuration.xmlOut);
|
533 |
| } |
534 |
0
| else if (configuration.xmlOut && !configuration.xHTML)
|
535 |
| { |
536 |
0
| pprint.printXMLTree(o, (short) 0, 0, lexer, document);
|
537 |
| } |
538 |
| else |
539 |
| { |
540 |
0
| pprint.printTree(o, (short) 0, 0, lexer, document);
|
541 |
| } |
542 |
| |
543 |
0
| pprint.flushLine(o, 0);
|
544 |
0
| o.close();
|
545 |
| } |
546 |
| catch (IOException e) |
547 |
| { |
548 |
0
| errout.println(file + e.toString());
|
549 |
| } |
550 |
| } |
551 |
216
| else if (out != null)
|
552 |
| { |
553 |
216
| pprint = new PPrint(configuration);
|
554 |
| |
555 |
216
| Out o = OutFactory.getOut(this.configuration, out);
|
556 |
| |
557 |
216
| if (document.findDocType() == null)
|
558 |
| { |
559 |
| |
560 |
| |
561 |
34
| configuration.numEntities = true;
|
562 |
| } |
563 |
216
| if (configuration.bodyOnly)
|
564 |
| { |
565 |
| |
566 |
2
| pprint.printBody(o, lexer, document, configuration.xmlOut);
|
567 |
| } |
568 |
214
| else if (configuration.xmlOut && !configuration.xHTML)
|
569 |
| { |
570 |
19
| pprint.printXMLTree(o, (short) 0, 0, lexer, document);
|
571 |
| } |
572 |
| else |
573 |
| { |
574 |
195
| pprint.printTree(o, (short) 0, 0, lexer, document);
|
575 |
| } |
576 |
| |
577 |
216
| pprint.flushLine(o, 0);
|
578 |
216
| o.close();
|
579 |
| } |
580 |
| |
581 |
| } |
582 |
| |
583 |
233
| if (!configuration.quiet)
|
584 |
| { |
585 |
228
| this.report.errorSummary(lexer);
|
586 |
| } |
587 |
| } |
588 |
233
| return document;
|
589 |
| } |
590 |
| |
591 |
| |
592 |
| |
593 |
| |
594 |
| |
595 |
| |
596 |
| |
597 |
3
| public org.w3c.dom.Document parseDOM(InputStream in, OutputStream out)
|
598 |
| { |
599 |
3
| Node document = parse(in, out);
|
600 |
3
| if (document != null)
|
601 |
| { |
602 |
3
| return (org.w3c.dom.Document) document.getAdapter();
|
603 |
| } |
604 |
0
| return null;
|
605 |
| } |
606 |
| |
607 |
| |
608 |
| |
609 |
| |
610 |
| |
611 |
0
| public static org.w3c.dom.Document createEmptyDocument()
|
612 |
| { |
613 |
0
| Node document = new Node(Node.ROOT_NODE, new byte[0], 0, 0);
|
614 |
0
| Node node = new Node(Node.START_TAG, new byte[0], 0, 0, "html", new TagTable());
|
615 |
0
| if (document != null && node != null)
|
616 |
| { |
617 |
0
| document.insertNodeAtStart(node);
|
618 |
0
| return (org.w3c.dom.Document) document.getAdapter();
|
619 |
| } |
620 |
| |
621 |
0
| return null;
|
622 |
| } |
623 |
| |
624 |
| |
625 |
| |
626 |
| |
627 |
| |
628 |
| |
629 |
2
| public void pprint(org.w3c.dom.Document doc, OutputStream out)
|
630 |
| { |
631 |
2
| if (!(doc instanceof DOMDocumentImpl))
|
632 |
| { |
633 |
| |
634 |
0
| return;
|
635 |
| } |
636 |
| |
637 |
2
| pprint(((DOMDocumentImpl) doc).adaptee, out);
|
638 |
| } |
639 |
| |
640 |
| |
641 |
| |
642 |
| |
643 |
| |
644 |
| |
645 |
0
| public void pprint(org.w3c.dom.Node node, OutputStream out)
|
646 |
| { |
647 |
0
| if (!(node instanceof DOMNodeImpl))
|
648 |
| { |
649 |
| |
650 |
0
| return;
|
651 |
| } |
652 |
| |
653 |
0
| pprint(((DOMNodeImpl) node).adaptee, out);
|
654 |
| } |
655 |
| |
656 |
| |
657 |
| |
658 |
| |
659 |
| |
660 |
| |
661 |
2
| private void pprint(Node node, OutputStream out)
|
662 |
| { |
663 |
2
| PPrint pprint;
|
664 |
| |
665 |
2
| if (out != null)
|
666 |
| { |
667 |
| |
668 |
2
| Out o = OutFactory.getOut(this.configuration, out);
|
669 |
| |
670 |
2
| Lexer lexer = new Lexer(null, this.configuration, this.report);
|
671 |
| |
672 |
2
| pprint = new PPrint(configuration);
|
673 |
| |
674 |
2
| if (configuration.xmlTags)
|
675 |
| { |
676 |
0
| pprint.printXMLTree(o, (short) 0, 0, lexer, node);
|
677 |
| } |
678 |
| else |
679 |
| { |
680 |
2
| pprint.printTree(o, (short) 0, 0, lexer, node);
|
681 |
| } |
682 |
| |
683 |
2
| pprint.flushLine(o, 0);
|
684 |
| } |
685 |
| } |
686 |
| |
687 |
| |
688 |
| |
689 |
| |
690 |
| |
691 |
0
| public static void main(String[] argv)
|
692 |
| { |
693 |
0
| Tidy tidy = new Tidy();
|
694 |
0
| int returnCode = tidy.mainExec(argv);
|
695 |
0
| System.exit(returnCode);
|
696 |
| } |
697 |
| |
698 |
| |
699 |
| |
700 |
| |
701 |
| |
702 |
| |
703 |
| |
704 |
1
| protected int mainExec(String[] argv)
|
705 |
| { |
706 |
1
| String file;
|
707 |
1
| int argCount = argv.length;
|
708 |
1
| int argIndex = 0;
|
709 |
| |
710 |
| |
711 |
1
| Properties properties = new Properties();
|
712 |
| |
713 |
2
| while (argCount > 0)
|
714 |
| { |
715 |
2
| if (argv[argIndex].startsWith("-"))
|
716 |
| { |
717 |
| |
718 |
1
| String argName = argv[argIndex].toLowerCase();
|
719 |
1
| while (argName.length() > 0 && argName.charAt(0) == '-')
|
720 |
| { |
721 |
1
| argName = argName.substring(1);
|
722 |
| } |
723 |
| |
724 |
| |
725 |
1
| if (argName.equals("help") || argName.equals("h") || argName.equals("?"))
|
726 |
| { |
727 |
0
| this.report.helpText(new PrintWriter(System.out, true));
|
728 |
0
| return 0;
|
729 |
| } |
730 |
1
| else if (argName.equals("help-config"))
|
731 |
| { |
732 |
0
| configuration.printConfigOptions(new PrintWriter(System.out, true), false);
|
733 |
0
| return 0;
|
734 |
| } |
735 |
1
| else if (argName.equals("show-config"))
|
736 |
| { |
737 |
0
| configuration.adjust();
|
738 |
0
| configuration.printConfigOptions(errout, true);
|
739 |
0
| return 0;
|
740 |
| } |
741 |
1
| else if (argName.equals("version") || argName.equals("v"))
|
742 |
| { |
743 |
0
| this.report.showVersion(errout);
|
744 |
0
| return 0;
|
745 |
| } |
746 |
| |
747 |
| |
748 |
1
| String argValue = null;
|
749 |
1
| if (argCount > 2 && !argv[argIndex + 1].startsWith("-"))
|
750 |
| { |
751 |
0
| argValue = argv[argIndex + 1];
|
752 |
0
| --argCount;
|
753 |
0
| ++argIndex;
|
754 |
| } |
755 |
| |
756 |
| |
757 |
1
| String alias = (String) CMDLINE_ALIAS.get(argName);
|
758 |
1
| if (alias != null)
|
759 |
| { |
760 |
0
| argName = alias;
|
761 |
| } |
762 |
| |
763 |
1
| if (Configuration.isKnownOption(argName))
|
764 |
| { |
765 |
0
| properties.setProperty(argName, (argValue == null ? "" : argName));
|
766 |
| } |
767 |
1
| else if (argName.equals("config"))
|
768 |
| { |
769 |
0
| if (argValue != null)
|
770 |
| { |
771 |
0
| configuration.parseFile(argValue);
|
772 |
| } |
773 |
| } |
774 |
1
| else if (TidyUtils.isCharEncodingSupported(argName))
|
775 |
| { |
776 |
0
| properties.setProperty("char-encoding", argName);
|
777 |
| } |
778 |
| else |
779 |
| { |
780 |
| |
781 |
1
| for (int i = 0; i < argName.length(); i++)
|
782 |
| { |
783 |
2
| switch (argName.charAt(i))
|
784 |
| { |
785 |
0
| case 'i' :
|
786 |
0
| configuration.indentContent = true;
|
787 |
0
| configuration.smartIndent = true;
|
788 |
0
| break;
|
789 |
| |
790 |
0
| case 'o' :
|
791 |
0
| configuration.hideEndTags = true;
|
792 |
0
| break;
|
793 |
| |
794 |
0
| case 'u' :
|
795 |
0
| configuration.upperCaseTags = true;
|
796 |
0
| break;
|
797 |
| |
798 |
0
| case 'c' :
|
799 |
0
| configuration.makeClean = true;
|
800 |
0
| break;
|
801 |
| |
802 |
0
| case 'b' :
|
803 |
0
| configuration.makeBare = true;
|
804 |
0
| break;
|
805 |
| |
806 |
0
| case 'n' :
|
807 |
0
| configuration.numEntities = true;
|
808 |
0
| break;
|
809 |
| |
810 |
0
| case 'm' :
|
811 |
0
| configuration.writeback = true;
|
812 |
0
| break;
|
813 |
| |
814 |
1
| case 'e' :
|
815 |
1
| configuration.onlyErrors = true;
|
816 |
1
| break;
|
817 |
| |
818 |
1
| case 'q' :
|
819 |
1
| configuration.quiet = true;
|
820 |
1
| break;
|
821 |
| |
822 |
0
| default :
|
823 |
0
| this.report.unknownOption(this.errout, argName.charAt(i));
|
824 |
0
| break;
|
825 |
| } |
826 |
| } |
827 |
| } |
828 |
| |
829 |
1
| --argCount;
|
830 |
1
| ++argIndex;
|
831 |
1
| continue;
|
832 |
| } |
833 |
| |
834 |
1
| configuration.addProps(properties);
|
835 |
| |
836 |
| |
837 |
1
| configuration.adjust();
|
838 |
| |
839 |
| |
840 |
1
| if (configuration.errfile != null)
|
841 |
| { |
842 |
| |
843 |
0
| String errorfile = "stderr";
|
844 |
| |
845 |
| |
846 |
0
| if (!configuration.errfile.equals(errorfile))
|
847 |
| { |
848 |
| |
849 |
| |
850 |
0
| if (this.errout != this.stderr)
|
851 |
| { |
852 |
0
| this.errout.close();
|
853 |
| } |
854 |
| |
855 |
| |
856 |
0
| try
|
857 |
| { |
858 |
0
| this.setErrout(new PrintWriter(new FileWriter(configuration.errfile), true));
|
859 |
0
| errorfile = configuration.errfile;
|
860 |
| } |
861 |
| catch (IOException e) |
862 |
| { |
863 |
| |
864 |
0
| errorfile = "stderr";
|
865 |
0
| this.setErrout(stderr);
|
866 |
| } |
867 |
| } |
868 |
| } |
869 |
| |
870 |
1
| if (argCount > 0)
|
871 |
| { |
872 |
1
| file = argv[argIndex];
|
873 |
| } |
874 |
| else |
875 |
| { |
876 |
0
| file = "stdin";
|
877 |
| } |
878 |
| |
879 |
1
| try
|
880 |
| { |
881 |
1
| parse(null, file, System.out);
|
882 |
| } |
883 |
| catch (FileNotFoundException fnfe) |
884 |
| { |
885 |
0
| this.report.unknownFile(this.errout, file);
|
886 |
| } |
887 |
| catch (IOException ioe) |
888 |
| { |
889 |
0
| this.report.unknownFile(this.errout, file);
|
890 |
| } |
891 |
| |
892 |
1
| --argCount;
|
893 |
1
| ++argIndex;
|
894 |
| |
895 |
1
| if (argCount <= 0)
|
896 |
| { |
897 |
1
| break;
|
898 |
| } |
899 |
| } |
900 |
| |
901 |
1
| if (this.parseErrors + this.parseWarnings > 0 && !configuration.quiet)
|
902 |
| { |
903 |
0
| this.report.generalInfo(this.errout);
|
904 |
| } |
905 |
| |
906 |
1
| if (this.errout != this.stderr)
|
907 |
| { |
908 |
0
| this.errout.close();
|
909 |
| } |
910 |
| |
911 |
| |
912 |
1
| if (this.parseErrors > 0)
|
913 |
| { |
914 |
0
| return 2;
|
915 |
| } |
916 |
| |
917 |
1
| if (this.parseWarnings > 0)
|
918 |
| { |
919 |
0
| return 1;
|
920 |
| } |
921 |
| |
922 |
| |
923 |
1
| return 0;
|
924 |
| } |
925 |
| |
926 |
| |
927 |
| |
928 |
| |
929 |
| |
930 |
219
| public void setMessageListener(TidyMessageListener listener)
|
931 |
| { |
932 |
219
| this.report.addMessageListener(listener);
|
933 |
| } |
934 |
| |
935 |
| |
936 |
| |
937 |
| |
938 |
| |
939 |
| |
940 |
0
| public void setSpaces(int spaces)
|
941 |
| { |
942 |
0
| configuration.spaces = spaces;
|
943 |
| } |
944 |
| |
945 |
| |
946 |
| |
947 |
| |
948 |
| |
949 |
| |
950 |
0
| public int getSpaces()
|
951 |
| { |
952 |
0
| return configuration.spaces;
|
953 |
| } |
954 |
| |
955 |
| |
956 |
| |
957 |
| |
958 |
| |
959 |
| |
960 |
0
| public void setWraplen(int wraplen)
|
961 |
| { |
962 |
0
| configuration.wraplen = wraplen;
|
963 |
| } |
964 |
| |
965 |
| |
966 |
| |
967 |
| |
968 |
| |
969 |
| |
970 |
0
| public int getWraplen()
|
971 |
| { |
972 |
0
| return configuration.wraplen;
|
973 |
| } |
974 |
| |
975 |
| |
976 |
| |
977 |
| |
978 |
| |
979 |
| |
980 |
0
| public void setTabsize(int tabsize)
|
981 |
| { |
982 |
0
| configuration.tabsize = tabsize;
|
983 |
| } |
984 |
| |
985 |
| |
986 |
| |
987 |
| |
988 |
| |
989 |
| |
990 |
0
| public int getTabsize()
|
991 |
| { |
992 |
0
| return configuration.tabsize;
|
993 |
| } |
994 |
| |
995 |
| |
996 |
| |
997 |
| |
998 |
| |
999 |
| |
1000 |
0
| public void setErrfile(String errfile)
|
1001 |
| { |
1002 |
0
| configuration.errfile = errfile;
|
1003 |
| } |
1004 |
| |
1005 |
| |
1006 |
| |
1007 |
| |
1008 |
| |
1009 |
| |
1010 |
0
| public String getErrfile()
|
1011 |
| { |
1012 |
0
| return configuration.errfile;
|
1013 |
| } |
1014 |
| |
1015 |
| |
1016 |
| |
1017 |
| |
1018 |
| |
1019 |
| |
1020 |
0
| public void setWriteback(boolean writeback)
|
1021 |
| { |
1022 |
0
| configuration.writeback = writeback;
|
1023 |
| } |
1024 |
| |
1025 |
| |
1026 |
| |
1027 |
| |
1028 |
| |
1029 |
| |
1030 |
0
| public boolean getWriteback()
|
1031 |
| { |
1032 |
0
| return configuration.writeback;
|
1033 |
| } |
1034 |
| |
1035 |
| |
1036 |
| |
1037 |
| |
1038 |
| |
1039 |
| |
1040 |
0
| public void setOnlyErrors(boolean onlyErrors)
|
1041 |
| { |
1042 |
0
| configuration.onlyErrors = onlyErrors;
|
1043 |
| } |
1044 |
| |
1045 |
| |
1046 |
| |
1047 |
| |
1048 |
| |
1049 |
| |
1050 |
0
| public boolean getOnlyErrors()
|
1051 |
| { |
1052 |
0
| return configuration.onlyErrors;
|
1053 |
| } |
1054 |
| |
1055 |
| |
1056 |
| |
1057 |
| |
1058 |
| |
1059 |
| |
1060 |
0
| public void setShowWarnings(boolean showWarnings)
|
1061 |
| { |
1062 |
0
| configuration.showWarnings = showWarnings;
|
1063 |
| } |
1064 |
| |
1065 |
| |
1066 |
| |
1067 |
| |
1068 |
| |
1069 |
| |
1070 |
0
| public boolean getShowWarnings()
|
1071 |
| { |
1072 |
0
| return configuration.showWarnings;
|
1073 |
| } |
1074 |
| |
1075 |
| |
1076 |
| |
1077 |
| |
1078 |
| |
1079 |
| |
1080 |
0
| public void setQuiet(boolean quiet)
|
1081 |
| { |
1082 |
0
| configuration.quiet = quiet;
|
1083 |
| } |
1084 |
| |
1085 |
| |
1086 |
| |
1087 |
| |
1088 |
| |
1089 |
| |
1090 |
0
| public boolean getQuiet()
|
1091 |
| { |
1092 |
0
| return configuration.quiet;
|
1093 |
| } |
1094 |
| |
1095 |
| |
1096 |
| |
1097 |
| |
1098 |
| |
1099 |
| |
1100 |
0
| public void setIndentContent(boolean indentContent)
|
1101 |
| { |
1102 |
0
| configuration.indentContent = indentContent;
|
1103 |
| } |
1104 |
| |
1105 |
| |
1106 |
| |
1107 |
| |
1108 |
| |
1109 |
| |
1110 |
0
| public boolean getIndentContent()
|
1111 |
| { |
1112 |
0
| return configuration.indentContent;
|
1113 |
| } |
1114 |
| |
1115 |
| |
1116 |
| |
1117 |
| |
1118 |
| |
1119 |
| |
1120 |
0
| public void setSmartIndent(boolean smartIndent)
|
1121 |
| { |
1122 |
0
| configuration.smartIndent = smartIndent;
|
1123 |
| } |
1124 |
| |
1125 |
| |
1126 |
| |
1127 |
| |
1128 |
| |
1129 |
| |
1130 |
0
| public boolean getSmartIndent()
|
1131 |
| { |
1132 |
0
| return configuration.smartIndent;
|
1133 |
| } |
1134 |
| |
1135 |
| |
1136 |
| |
1137 |
| |
1138 |
| |
1139 |
| |
1140 |
0
| public void setHideEndTags(boolean hideEndTags)
|
1141 |
| { |
1142 |
0
| configuration.hideEndTags = hideEndTags;
|
1143 |
| } |
1144 |
| |
1145 |
| |
1146 |
| |
1147 |
| |
1148 |
| |
1149 |
| |
1150 |
0
| public boolean getHideEndTags()
|
1151 |
| { |
1152 |
0
| return configuration.hideEndTags;
|
1153 |
| } |
1154 |
| |
1155 |
| |
1156 |
| |
1157 |
| |
1158 |
| |
1159 |
| |
1160 |
0
| public void setXmlTags(boolean xmlTags)
|
1161 |
| { |
1162 |
0
| configuration.xmlTags = xmlTags;
|
1163 |
| } |
1164 |
| |
1165 |
| |
1166 |
| |
1167 |
| |
1168 |
| |
1169 |
| |
1170 |
0
| public boolean getXmlTags()
|
1171 |
| { |
1172 |
0
| return configuration.xmlTags;
|
1173 |
| } |
1174 |
| |
1175 |
| |
1176 |
| |
1177 |
| |
1178 |
| |
1179 |
| |
1180 |
0
| public void setXmlOut(boolean xmlOut)
|
1181 |
| { |
1182 |
0
| configuration.xmlOut = xmlOut;
|
1183 |
| } |
1184 |
| |
1185 |
| |
1186 |
| |
1187 |
| |
1188 |
| |
1189 |
| |
1190 |
0
| public boolean getXmlOut()
|
1191 |
| { |
1192 |
0
| return configuration.xmlOut;
|
1193 |
| } |
1194 |
| |
1195 |
| |
1196 |
| |
1197 |
| |
1198 |
| |
1199 |
| |
1200 |
0
| public void setXHTML(boolean xhtml)
|
1201 |
| { |
1202 |
0
| configuration.xHTML = xhtml;
|
1203 |
| } |
1204 |
| |
1205 |
| |
1206 |
| |
1207 |
| |
1208 |
| |
1209 |
| |
1210 |
0
| public boolean getXHTML()
|
1211 |
| { |
1212 |
0
| return configuration.xHTML;
|
1213 |
| } |
1214 |
| |
1215 |
| |
1216 |
| |
1217 |
| |
1218 |
| |
1219 |
| |
1220 |
0
| public void setUpperCaseTags(boolean upperCaseTags)
|
1221 |
| { |
1222 |
0
| configuration.upperCaseTags = upperCaseTags;
|
1223 |
| } |
1224 |
| |
1225 |
| |
1226 |
| |
1227 |
| |
1228 |
| |
1229 |
| |
1230 |
0
| public boolean getUpperCaseTags()
|
1231 |
| { |
1232 |
0
| return configuration.upperCaseTags;
|
1233 |
| } |
1234 |
| |
1235 |
| |
1236 |
| |
1237 |
| |
1238 |
| |
1239 |
| |
1240 |
0
| public void setUpperCaseAttrs(boolean upperCaseAttrs)
|
1241 |
| { |
1242 |
0
| configuration.upperCaseAttrs = upperCaseAttrs;
|
1243 |
| } |
1244 |
| |
1245 |
| |
1246 |
| |
1247 |
| |
1248 |
| |
1249 |
| |
1250 |
0
| public boolean getUpperCaseAttrs()
|
1251 |
| { |
1252 |
0
| return configuration.upperCaseAttrs;
|
1253 |
| } |
1254 |
| |
1255 |
| |
1256 |
| |
1257 |
| |
1258 |
| |
1259 |
| |
1260 |
0
| public void setMakeClean(boolean makeClean)
|
1261 |
| { |
1262 |
0
| configuration.makeClean = makeClean;
|
1263 |
| } |
1264 |
| |
1265 |
| |
1266 |
| |
1267 |
| |
1268 |
| |
1269 |
| |
1270 |
0
| public boolean getMakeClean()
|
1271 |
| { |
1272 |
0
| return configuration.makeClean;
|
1273 |
| } |
1274 |
| |
1275 |
| |
1276 |
| |
1277 |
| |
1278 |
| |
1279 |
| |
1280 |
0
| public void setMakeBare(boolean makeBare)
|
1281 |
| { |
1282 |
0
| configuration.makeBare = makeBare;
|
1283 |
| } |
1284 |
| |
1285 |
| |
1286 |
| |
1287 |
| |
1288 |
| |
1289 |
| |
1290 |
0
| public boolean getMakeBare()
|
1291 |
| { |
1292 |
0
| return configuration.makeBare;
|
1293 |
| } |
1294 |
| |
1295 |
| |
1296 |
| |
1297 |
| |
1298 |
| |
1299 |
| |
1300 |
0
| public void setBreakBeforeBR(boolean breakBeforeBR)
|
1301 |
| { |
1302 |
0
| configuration.breakBeforeBR = breakBeforeBR;
|
1303 |
| } |
1304 |
| |
1305 |
| |
1306 |
| |
1307 |
| |
1308 |
| |
1309 |
| |
1310 |
0
| public boolean getBreakBeforeBR()
|
1311 |
| { |
1312 |
0
| return configuration.breakBeforeBR;
|
1313 |
| } |
1314 |
| |
1315 |
| |
1316 |
| |
1317 |
| |
1318 |
| |
1319 |
| |
1320 |
0
| public void setBurstSlides(boolean burstSlides)
|
1321 |
| { |
1322 |
0
| configuration.burstSlides = burstSlides;
|
1323 |
| } |
1324 |
| |
1325 |
| |
1326 |
| |
1327 |
| |
1328 |
| |
1329 |
| |
1330 |
0
| public boolean getBurstSlides()
|
1331 |
| { |
1332 |
0
| return configuration.burstSlides;
|
1333 |
| } |
1334 |
| |
1335 |
| |
1336 |
| |
1337 |
| |
1338 |
| |
1339 |
| |
1340 |
| |
1341 |
0
| public void setNumEntities(boolean numEntities)
|
1342 |
| { |
1343 |
0
| configuration.numEntities = numEntities;
|
1344 |
| } |
1345 |
| |
1346 |
| |
1347 |
| |
1348 |
| |
1349 |
| |
1350 |
| |
1351 |
| |
1352 |
0
| public boolean getNumEntities()
|
1353 |
| { |
1354 |
0
| return configuration.numEntities;
|
1355 |
| } |
1356 |
| |
1357 |
| |
1358 |
| |
1359 |
| |
1360 |
| |
1361 |
| |
1362 |
0
| public void setQuoteMarks(boolean quoteMarks)
|
1363 |
| { |
1364 |
0
| configuration.quoteMarks = quoteMarks;
|
1365 |
| } |
1366 |
| |
1367 |
| |
1368 |
| |
1369 |
| |
1370 |
| |
1371 |
| |
1372 |
0
| public boolean getQuoteMarks()
|
1373 |
| { |
1374 |
0
| return configuration.quoteMarks;
|
1375 |
| } |
1376 |
| |
1377 |
| |
1378 |
| |
1379 |
| |
1380 |
| |
1381 |
| |
1382 |
0
| public void setQuoteNbsp(boolean quoteNbsp)
|
1383 |
| { |
1384 |
0
| configuration.quoteNbsp = quoteNbsp;
|
1385 |
| } |
1386 |
| |
1387 |
| |
1388 |
| |
1389 |
| |
1390 |
| |
1391 |
| |
1392 |
0
| public boolean getQuoteNbsp()
|
1393 |
| { |
1394 |
0
| return configuration.quoteNbsp;
|
1395 |
| } |
1396 |
| |
1397 |
| |
1398 |
| |
1399 |
| |
1400 |
| |
1401 |
| |
1402 |
0
| public void setQuoteAmpersand(boolean quoteAmpersand)
|
1403 |
| { |
1404 |
0
| configuration.quoteAmpersand = quoteAmpersand;
|
1405 |
| } |
1406 |
| |
1407 |
| |
1408 |
| |
1409 |
| |
1410 |
| |
1411 |
| |
1412 |
0
| public boolean getQuoteAmpersand()
|
1413 |
| { |
1414 |
0
| return configuration.quoteAmpersand;
|
1415 |
| } |
1416 |
| |
1417 |
| |
1418 |
| |
1419 |
| |
1420 |
| |
1421 |
| |
1422 |
0
| public void setWrapAttVals(boolean wrapAttVals)
|
1423 |
| { |
1424 |
0
| configuration.wrapAttVals = wrapAttVals;
|
1425 |
| } |
1426 |
| |
1427 |
| |
1428 |
| |
1429 |
| |
1430 |
| |
1431 |
| |
1432 |
0
| public boolean getWrapAttVals()
|
1433 |
| { |
1434 |
0
| return configuration.wrapAttVals;
|
1435 |
| } |
1436 |
| |
1437 |
| |
1438 |
| |
1439 |
| |
1440 |
| |
1441 |
| |
1442 |
0
| public void setWrapScriptlets(boolean wrapScriptlets)
|
1443 |
| { |
1444 |
0
| configuration.wrapScriptlets = wrapScriptlets;
|
1445 |
| } |
1446 |
| |
1447 |
| |
1448 |
| |
1449 |
| |
1450 |
| |
1451 |
| |
1452 |
0
| public boolean getWrapScriptlets()
|
1453 |
| { |
1454 |
0
| return configuration.wrapScriptlets;
|
1455 |
| } |
1456 |
| |
1457 |
| |
1458 |
| |
1459 |
| |
1460 |
| |
1461 |
| |
1462 |
0
| public void setWrapSection(boolean wrapSection)
|
1463 |
| { |
1464 |
0
| configuration.wrapSection = wrapSection;
|
1465 |
| } |
1466 |
| |
1467 |
| |
1468 |
| |
1469 |
| |
1470 |
| |
1471 |
| |
1472 |
0
| public boolean getWrapSection()
|
1473 |
| { |
1474 |
0
| return configuration.wrapSection;
|
1475 |
| } |
1476 |
| |
1477 |
| |
1478 |
| |
1479 |
| |
1480 |
| |
1481 |
| |
1482 |
0
| public void setAltText(String altText)
|
1483 |
| { |
1484 |
0
| configuration.altText = altText;
|
1485 |
| } |
1486 |
| |
1487 |
| |
1488 |
| |
1489 |
| |
1490 |
| |
1491 |
| |
1492 |
0
| public String getAltText()
|
1493 |
| { |
1494 |
0
| return configuration.altText;
|
1495 |
| } |
1496 |
| |
1497 |
| |
1498 |
| |
1499 |
| |
1500 |
| |
1501 |
| |
1502 |
0
| public void setXmlPi(boolean xmlPi)
|
1503 |
| { |
1504 |
0
| configuration.xmlPi = xmlPi;
|
1505 |
| } |
1506 |
| |
1507 |
| |
1508 |
| |
1509 |
| |
1510 |
| |
1511 |
| |
1512 |
0
| public boolean getXmlPi()
|
1513 |
| { |
1514 |
0
| return configuration.xmlPi;
|
1515 |
| } |
1516 |
| |
1517 |
| |
1518 |
| |
1519 |
| |
1520 |
| |
1521 |
| |
1522 |
0
| public void setDropFontTags(boolean dropFontTags)
|
1523 |
| { |
1524 |
0
| configuration.dropFontTags = dropFontTags;
|
1525 |
| } |
1526 |
| |
1527 |
| |
1528 |
| |
1529 |
| |
1530 |
| |
1531 |
| |
1532 |
0
| public boolean getDropFontTags()
|
1533 |
| { |
1534 |
0
| return configuration.dropFontTags;
|
1535 |
| } |
1536 |
| |
1537 |
| |
1538 |
| |
1539 |
| |
1540 |
| |
1541 |
| |
1542 |
0
| public void setDropProprietaryAttributes(boolean dropProprietaryAttributes)
|
1543 |
| { |
1544 |
0
| configuration.dropProprietaryAttributes = dropProprietaryAttributes;
|
1545 |
| } |
1546 |
| |
1547 |
| |
1548 |
| |
1549 |
| |
1550 |
| |
1551 |
| |
1552 |
0
| public boolean getDropProprietaryAttributes()
|
1553 |
| { |
1554 |
0
| return configuration.dropProprietaryAttributes;
|
1555 |
| } |
1556 |
| |
1557 |
| |
1558 |
| |
1559 |
| |
1560 |
| |
1561 |
| |
1562 |
0
| public void setDropEmptyParas(boolean dropEmptyParas)
|
1563 |
| { |
1564 |
0
| configuration.dropEmptyParas = dropEmptyParas;
|
1565 |
| } |
1566 |
| |
1567 |
| |
1568 |
| |
1569 |
| |
1570 |
| |
1571 |
| |
1572 |
0
| public boolean getDropEmptyParas()
|
1573 |
| { |
1574 |
0
| return configuration.dropEmptyParas;
|
1575 |
| } |
1576 |
| |
1577 |
| |
1578 |
| |
1579 |
| |
1580 |
| |
1581 |
| |
1582 |
0
| public void setFixComments(boolean fixComments)
|
1583 |
| { |
1584 |
0
| configuration.fixComments = fixComments;
|
1585 |
| } |
1586 |
| |
1587 |
| |
1588 |
| |
1589 |
| |
1590 |
| |
1591 |
| |
1592 |
0
| public boolean getFixComments()
|
1593 |
| { |
1594 |
0
| return configuration.fixComments;
|
1595 |
| } |
1596 |
| |
1597 |
| |
1598 |
| |
1599 |
| |
1600 |
| |
1601 |
| |
1602 |
0
| public void setWrapAsp(boolean wrapAsp)
|
1603 |
| { |
1604 |
0
| configuration.wrapAsp = wrapAsp;
|
1605 |
| } |
1606 |
| |
1607 |
| |
1608 |
| |
1609 |
| |
1610 |
| |
1611 |
| |
1612 |
0
| public boolean getWrapAsp()
|
1613 |
| { |
1614 |
0
| return configuration.wrapAsp;
|
1615 |
| } |
1616 |
| |
1617 |
| |
1618 |
| |
1619 |
| |
1620 |
| |
1621 |
| |
1622 |
0
| public void setWrapJste(boolean wrapJste)
|
1623 |
| { |
1624 |
0
| configuration.wrapJste = wrapJste;
|
1625 |
| } |
1626 |
| |
1627 |
| |
1628 |
| |
1629 |
| |
1630 |
| |
1631 |
| |
1632 |
0
| public boolean getWrapJste()
|
1633 |
| { |
1634 |
0
| return configuration.wrapJste;
|
1635 |
| } |
1636 |
| |
1637 |
| |
1638 |
| |
1639 |
| |
1640 |
| |
1641 |
| |
1642 |
0
| public void setWrapPhp(boolean wrapPhp)
|
1643 |
| { |
1644 |
0
| configuration.wrapPhp = wrapPhp;
|
1645 |
| } |
1646 |
| |
1647 |
| |
1648 |
| |
1649 |
| |
1650 |
| |
1651 |
| |
1652 |
0
| public boolean getWrapPhp()
|
1653 |
| { |
1654 |
0
| return configuration.wrapPhp;
|
1655 |
| } |
1656 |
| |
1657 |
| |
1658 |
| |
1659 |
| |
1660 |
| |
1661 |
| |
1662 |
0
| public void setFixBackslash(boolean fixBackslash)
|
1663 |
| { |
1664 |
0
| configuration.fixBackslash = fixBackslash;
|
1665 |
| } |
1666 |
| |
1667 |
| |
1668 |
| |
1669 |
| |
1670 |
| |
1671 |
| |
1672 |
0
| public boolean getFixBackslash()
|
1673 |
| { |
1674 |
0
| return configuration.fixBackslash;
|
1675 |
| } |
1676 |
| |
1677 |
| |
1678 |
| |
1679 |
| |
1680 |
| |
1681 |
| |
1682 |
0
| public void setIndentAttributes(boolean indentAttributes)
|
1683 |
| { |
1684 |
0
| configuration.indentAttributes = indentAttributes;
|
1685 |
| } |
1686 |
| |
1687 |
| |
1688 |
| |
1689 |
| |
1690 |
| |
1691 |
| |
1692 |
0
| public boolean getIndentAttributes()
|
1693 |
| { |
1694 |
0
| return configuration.indentAttributes;
|
1695 |
| } |
1696 |
| |
1697 |
| |
1698 |
| |
1699 |
| |
1700 |
| |
1701 |
| |
1702 |
| |
1703 |
| |
1704 |
| |
1705 |
0
| public void setDocType(String doctype)
|
1706 |
| { |
1707 |
0
| if (doctype != null)
|
1708 |
| { |
1709 |
0
| configuration.docTypeStr = (String) ParsePropertyImpl.DOCTYPE.parse(doctype, "doctype", configuration);
|
1710 |
| } |
1711 |
| } |
1712 |
| |
1713 |
| |
1714 |
| |
1715 |
| |
1716 |
| |
1717 |
| |
1718 |
| |
1719 |
| |
1720 |
0
| public String getDocType()
|
1721 |
| { |
1722 |
0
| String result = null;
|
1723 |
0
| switch (configuration.docTypeMode)
|
1724 |
| { |
1725 |
0
| case Configuration.DOCTYPE_OMIT :
|
1726 |
0
| result = "omit";
|
1727 |
0
| break;
|
1728 |
0
| case Configuration.DOCTYPE_AUTO :
|
1729 |
0
| result = "auto";
|
1730 |
0
| break;
|
1731 |
0
| case Configuration.DOCTYPE_STRICT :
|
1732 |
0
| result = "strict";
|
1733 |
0
| break;
|
1734 |
0
| case Configuration.DOCTYPE_LOOSE :
|
1735 |
0
| result = "loose";
|
1736 |
0
| break;
|
1737 |
0
| case Configuration.DOCTYPE_USER :
|
1738 |
0
| result = configuration.docTypeStr;
|
1739 |
0
| break;
|
1740 |
| } |
1741 |
0
| return result;
|
1742 |
| } |
1743 |
| |
1744 |
| |
1745 |
| |
1746 |
| |
1747 |
| |
1748 |
| |
1749 |
0
| public void setLogicalEmphasis(boolean logicalEmphasis)
|
1750 |
| { |
1751 |
0
| configuration.logicalEmphasis = logicalEmphasis;
|
1752 |
| } |
1753 |
| |
1754 |
| |
1755 |
| |
1756 |
| |
1757 |
| |
1758 |
| |
1759 |
0
| public boolean getLogicalEmphasis()
|
1760 |
| { |
1761 |
0
| return configuration.logicalEmphasis;
|
1762 |
| } |
1763 |
| |
1764 |
| |
1765 |
| |
1766 |
| |
1767 |
| |
1768 |
| |
1769 |
| |
1770 |
| |
1771 |
0
| public void setXmlPIs(boolean xmlPIs)
|
1772 |
| { |
1773 |
0
| configuration.xmlPIs = xmlPIs;
|
1774 |
| } |
1775 |
| |
1776 |
| |
1777 |
| |
1778 |
| |
1779 |
| |
1780 |
| |
1781 |
| |
1782 |
| |
1783 |
0
| public boolean getXmlPIs()
|
1784 |
| { |
1785 |
0
| return configuration.xmlPIs;
|
1786 |
| } |
1787 |
| |
1788 |
| |
1789 |
| |
1790 |
| |
1791 |
| |
1792 |
| |
1793 |
0
| public void setEncloseText(boolean encloseText)
|
1794 |
| { |
1795 |
0
| configuration.encloseBodyText = encloseText;
|
1796 |
| } |
1797 |
| |
1798 |
| |
1799 |
| |
1800 |
| |
1801 |
| |
1802 |
| |
1803 |
0
| public boolean getEncloseText()
|
1804 |
| { |
1805 |
0
| return configuration.encloseBodyText;
|
1806 |
| } |
1807 |
| |
1808 |
| |
1809 |
| |
1810 |
| |
1811 |
| |
1812 |
| |
1813 |
0
| public void setEncloseBlockText(boolean encloseBlockText)
|
1814 |
| { |
1815 |
0
| configuration.encloseBlockText = encloseBlockText;
|
1816 |
| } |
1817 |
| |
1818 |
| |
1819 |
| |
1820 |
| |
1821 |
| |
1822 |
| |
1823 |
0
| public boolean getEncloseBlockText()
|
1824 |
| { |
1825 |
0
| return configuration.encloseBlockText;
|
1826 |
| } |
1827 |
| |
1828 |
| |
1829 |
| |
1830 |
| |
1831 |
| |
1832 |
| |
1833 |
0
| public void setWord2000(boolean word2000)
|
1834 |
| { |
1835 |
0
| configuration.word2000 = word2000;
|
1836 |
| } |
1837 |
| |
1838 |
| |
1839 |
| |
1840 |
| |
1841 |
| |
1842 |
| |
1843 |
0
| public boolean getWord2000()
|
1844 |
| { |
1845 |
0
| return configuration.word2000;
|
1846 |
| } |
1847 |
| |
1848 |
| |
1849 |
| |
1850 |
| |
1851 |
| |
1852 |
| |
1853 |
0
| public void setTidyMark(boolean tidyMark)
|
1854 |
| { |
1855 |
0
| configuration.tidyMark = tidyMark;
|
1856 |
| } |
1857 |
| |
1858 |
| |
1859 |
| |
1860 |
| |
1861 |
| |
1862 |
| |
1863 |
0
| public boolean getTidyMark()
|
1864 |
| { |
1865 |
0
| return configuration.tidyMark;
|
1866 |
| } |
1867 |
| |
1868 |
| |
1869 |
| |
1870 |
| |
1871 |
| |
1872 |
| |
1873 |
0
| public void setXmlSpace(boolean xmlSpace)
|
1874 |
| { |
1875 |
0
| configuration.xmlSpace = xmlSpace;
|
1876 |
| } |
1877 |
| |
1878 |
| |
1879 |
| |
1880 |
| |
1881 |
| |
1882 |
| |
1883 |
0
| public boolean getXmlSpace()
|
1884 |
| { |
1885 |
0
| return configuration.xmlSpace;
|
1886 |
| } |
1887 |
| |
1888 |
| |
1889 |
| |
1890 |
| |
1891 |
| |
1892 |
| |
1893 |
0
| public void setEmacs(boolean emacs)
|
1894 |
| { |
1895 |
0
| configuration.emacs = emacs;
|
1896 |
| } |
1897 |
| |
1898 |
| |
1899 |
| |
1900 |
| |
1901 |
| |
1902 |
| |
1903 |
0
| public boolean getEmacs()
|
1904 |
| { |
1905 |
0
| return configuration.emacs;
|
1906 |
| } |
1907 |
| |
1908 |
| |
1909 |
| |
1910 |
| |
1911 |
| |
1912 |
| |
1913 |
0
| public void setLiteralAttribs(boolean literalAttribs)
|
1914 |
| { |
1915 |
0
| configuration.literalAttribs = literalAttribs;
|
1916 |
| } |
1917 |
| |
1918 |
| |
1919 |
| |
1920 |
| |
1921 |
| |
1922 |
| |
1923 |
0
| public boolean getLiteralAttribs()
|
1924 |
| { |
1925 |
0
| return configuration.literalAttribs;
|
1926 |
| } |
1927 |
| |
1928 |
| |
1929 |
| |
1930 |
| |
1931 |
| |
1932 |
| |
1933 |
0
| public void setPrintBodyOnly(boolean bodyOnly)
|
1934 |
| { |
1935 |
0
| configuration.bodyOnly = bodyOnly;
|
1936 |
| } |
1937 |
| |
1938 |
| |
1939 |
| |
1940 |
| |
1941 |
| |
1942 |
0
| public boolean getPrintBodyOnly()
|
1943 |
| { |
1944 |
0
| return configuration.bodyOnly;
|
1945 |
| } |
1946 |
| |
1947 |
| |
1948 |
| |
1949 |
| |
1950 |
| |
1951 |
| |
1952 |
0
| public void setFixUri(boolean fixUri)
|
1953 |
| { |
1954 |
0
| configuration.fixUri = fixUri;
|
1955 |
| } |
1956 |
| |
1957 |
| |
1958 |
| |
1959 |
| |
1960 |
| |
1961 |
0
| public boolean getFixUri()
|
1962 |
| { |
1963 |
0
| return configuration.fixUri;
|
1964 |
| } |
1965 |
| |
1966 |
| |
1967 |
| |
1968 |
| |
1969 |
| |
1970 |
| |
1971 |
0
| public void setLowerLiterals(boolean lowerLiterals)
|
1972 |
| { |
1973 |
0
| configuration.lowerLiterals = lowerLiterals;
|
1974 |
| } |
1975 |
| |
1976 |
| |
1977 |
| |
1978 |
| |
1979 |
| |
1980 |
0
| public boolean getLowerLiterals()
|
1981 |
| { |
1982 |
0
| return configuration.lowerLiterals;
|
1983 |
| } |
1984 |
| |
1985 |
| |
1986 |
| |
1987 |
| |
1988 |
| |
1989 |
| |
1990 |
0
| public void setHideComments(boolean hideComments)
|
1991 |
| { |
1992 |
0
| configuration.hideComments = hideComments;
|
1993 |
| } |
1994 |
| |
1995 |
| |
1996 |
| |
1997 |
| |
1998 |
| |
1999 |
0
| public boolean getHideComments()
|
2000 |
| { |
2001 |
0
| return configuration.hideComments;
|
2002 |
| } |
2003 |
| |
2004 |
| |
2005 |
| |
2006 |
| |
2007 |
| |
2008 |
| |
2009 |
0
| public void setIndentCdata(boolean indentCdata)
|
2010 |
| { |
2011 |
0
| configuration.indentCdata = indentCdata;
|
2012 |
| } |
2013 |
| |
2014 |
| |
2015 |
| |
2016 |
| |
2017 |
| |
2018 |
0
| public boolean getIndentCdata()
|
2019 |
| { |
2020 |
0
| return configuration.indentCdata;
|
2021 |
| } |
2022 |
| |
2023 |
| |
2024 |
| |
2025 |
| |
2026 |
| |
2027 |
| |
2028 |
0
| public void setForceOutput(boolean forceOutput)
|
2029 |
| { |
2030 |
0
| configuration.forceOutput = forceOutput;
|
2031 |
| } |
2032 |
| |
2033 |
| |
2034 |
| |
2035 |
| |
2036 |
| |
2037 |
5
| public boolean getForceOutput()
|
2038 |
| { |
2039 |
5
| return configuration.forceOutput;
|
2040 |
| } |
2041 |
| |
2042 |
| |
2043 |
| |
2044 |
| |
2045 |
| |
2046 |
| |
2047 |
0
| public void setShowErrors(int showErrors)
|
2048 |
| { |
2049 |
0
| configuration.showErrors = showErrors;
|
2050 |
| } |
2051 |
| |
2052 |
| |
2053 |
| |
2054 |
| |
2055 |
| |
2056 |
0
| public int getShowErrors()
|
2057 |
| { |
2058 |
0
| return configuration.showErrors;
|
2059 |
| } |
2060 |
| |
2061 |
| |
2062 |
| |
2063 |
| |
2064 |
| |
2065 |
| |
2066 |
0
| public void setAsciiChars(boolean asciiChars)
|
2067 |
| { |
2068 |
0
| configuration.asciiChars = asciiChars;
|
2069 |
| } |
2070 |
| |
2071 |
| |
2072 |
| |
2073 |
| |
2074 |
| |
2075 |
0
| public boolean getAsciiChars()
|
2076 |
| { |
2077 |
0
| return configuration.asciiChars;
|
2078 |
| } |
2079 |
| |
2080 |
| |
2081 |
| |
2082 |
| |
2083 |
| |
2084 |
| |
2085 |
0
| public void setJoinClasses(boolean joinClasses)
|
2086 |
| { |
2087 |
0
| configuration.joinClasses = joinClasses;
|
2088 |
| } |
2089 |
| |
2090 |
| |
2091 |
| |
2092 |
| |
2093 |
| |
2094 |
0
| public boolean getJoinClasses()
|
2095 |
| { |
2096 |
0
| return configuration.joinClasses;
|
2097 |
| } |
2098 |
| |
2099 |
| |
2100 |
| |
2101 |
| |
2102 |
| |
2103 |
| |
2104 |
0
| public void setJoinStyles(boolean joinStyles)
|
2105 |
| { |
2106 |
0
| configuration.joinStyles = joinStyles;
|
2107 |
| } |
2108 |
| |
2109 |
| |
2110 |
| |
2111 |
| |
2112 |
| |
2113 |
0
| public boolean getJoinStyles()
|
2114 |
| { |
2115 |
0
| return configuration.joinStyles;
|
2116 |
| } |
2117 |
| |
2118 |
| |
2119 |
| |
2120 |
| |
2121 |
| |
2122 |
| |
2123 |
0
| public void setTrimEmptyElements(boolean trimEmpty)
|
2124 |
| { |
2125 |
0
| configuration.trimEmpty = trimEmpty;
|
2126 |
| } |
2127 |
| |
2128 |
| |
2129 |
| |
2130 |
| |
2131 |
| |
2132 |
0
| public boolean getTrimEmptyElements()
|
2133 |
| { |
2134 |
0
| return configuration.trimEmpty;
|
2135 |
| } |
2136 |
| |
2137 |
| |
2138 |
| |
2139 |
| |
2140 |
| |
2141 |
| |
2142 |
0
| public void setReplaceColor(boolean replaceColor)
|
2143 |
| { |
2144 |
0
| configuration.replaceColor = replaceColor;
|
2145 |
| } |
2146 |
| |
2147 |
| |
2148 |
| |
2149 |
| |
2150 |
| |
2151 |
0
| public boolean getReplaceColor()
|
2152 |
| { |
2153 |
0
| return configuration.replaceColor;
|
2154 |
| } |
2155 |
| |
2156 |
| |
2157 |
| |
2158 |
| |
2159 |
| |
2160 |
| |
2161 |
0
| public void setEscapeCdata(boolean escapeCdata)
|
2162 |
| { |
2163 |
0
| configuration.escapeCdata = escapeCdata;
|
2164 |
| } |
2165 |
| |
2166 |
| |
2167 |
| |
2168 |
| |
2169 |
| |
2170 |
0
| public boolean getEscapeCdata()
|
2171 |
| { |
2172 |
0
| return configuration.escapeCdata;
|
2173 |
| } |
2174 |
| |
2175 |
| |
2176 |
| |
2177 |
| |
2178 |
| |
2179 |
| |
2180 |
0
| public void setRepeatedAttributes(int repeatedAttributes)
|
2181 |
| { |
2182 |
0
| configuration.duplicateAttrs = repeatedAttributes;
|
2183 |
| } |
2184 |
| |
2185 |
| |
2186 |
| |
2187 |
| |
2188 |
| |
2189 |
0
| public int getRepeatedAttributes()
|
2190 |
| { |
2191 |
0
| return configuration.duplicateAttrs;
|
2192 |
| } |
2193 |
| |
2194 |
| |
2195 |
| |
2196 |
| |
2197 |
| |
2198 |
| |
2199 |
| |
2200 |
0
| public void setKeepFileTimes(boolean keepFileTimes)
|
2201 |
| { |
2202 |
0
| configuration.keepFileTimes = keepFileTimes;
|
2203 |
| } |
2204 |
| |
2205 |
| |
2206 |
| |
2207 |
| |
2208 |
| |
2209 |
| |
2210 |
| |
2211 |
0
| public boolean getKeepFileTimes()
|
2212 |
| { |
2213 |
0
| return configuration.keepFileTimes;
|
2214 |
| } |
2215 |
| |
2216 |
| |
2217 |
| |
2218 |
| |
2219 |
| |
2220 |
| |
2221 |
0
| public void setCharEncoding(int charencoding)
|
2222 |
| { |
2223 |
0
| String ceName = configuration.convertCharEncoding(charencoding);
|
2224 |
0
| if (ceName != null)
|
2225 |
| { |
2226 |
0
| configuration.setInCharEncodingName(ceName);
|
2227 |
0
| configuration.setOutCharEncodingName(ceName);
|
2228 |
| } |
2229 |
| } |
2230 |
| |
2231 |
| |
2232 |
| |
2233 |
| |
2234 |
| |
2235 |
| |
2236 |
| |
2237 |
0
| public int getCharEncoding()
|
2238 |
| { |
2239 |
0
| return configuration.getInCharEncoding();
|
2240 |
| } |
2241 |
| |
2242 |
| |
2243 |
| |
2244 |
| |
2245 |
| |
2246 |
0
| public void setSlidestyle(String slidestyle)
|
2247 |
| { |
2248 |
0
| configuration.slidestyle = slidestyle;
|
2249 |
| } |
2250 |
| |
2251 |
| |
2252 |
| |
2253 |
| |
2254 |
| |
2255 |
0
| public String getSlidestyle()
|
2256 |
| { |
2257 |
0
| return null;
|
2258 |
| } |
2259 |
| |
2260 |
| |
2261 |
| |
2262 |
| |
2263 |
| |
2264 |
| |
2265 |
| |
2266 |
0
| public void setRawOut(boolean rawOut)
|
2267 |
| { |
2268 |
0
| configuration.rawOut = rawOut;
|
2269 |
| } |
2270 |
| |
2271 |
| |
2272 |
| |
2273 |
| |
2274 |
| |
2275 |
| |
2276 |
0
| public boolean getRawOut()
|
2277 |
| { |
2278 |
0
| return configuration.rawOut;
|
2279 |
| } |
2280 |
| |
2281 |
| |
2282 |
| |
2283 |
| |
2284 |
| |
2285 |
0
| public void setInputEncoding(String encoding)
|
2286 |
| { |
2287 |
0
| configuration.setInCharEncodingName(encoding);
|
2288 |
| } |
2289 |
| |
2290 |
| |
2291 |
| |
2292 |
| |
2293 |
| |
2294 |
0
| public String getInputEncoding()
|
2295 |
| { |
2296 |
0
| return configuration.getInCharEncodingName();
|
2297 |
| } |
2298 |
| |
2299 |
| |
2300 |
| |
2301 |
| |
2302 |
| |
2303 |
0
| public void setOutputEncoding(String encoding)
|
2304 |
| { |
2305 |
0
| configuration.setOutCharEncodingName(encoding);
|
2306 |
| } |
2307 |
| |
2308 |
| |
2309 |
| |
2310 |
| |
2311 |
| |
2312 |
0
| public String getOutputEncoding()
|
2313 |
| { |
2314 |
0
| return configuration.getOutCharEncodingName();
|
2315 |
| } |
2316 |
| |
2317 |
| } |