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