KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > xml > io > OutputOptions


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Enhydra Application Server is Lutris
15  * Technologies, Inc. The Enhydra Application Server and portions created
16  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17  * All Rights Reserved.
18  *
19  * Contributor(s):
20  *
21  * $Id: OutputOptions.java,v 1.7 2005/01/26 08:29:24 jkjome Exp $
22  */

23 package org.enhydra.xml.io;
24
25 import org.enhydra.xml.xmlc.codegen.JavaCode;
26 import org.enhydra.xml.xmlc.codegen.JavaLang;
27
28 /**
29  * Object that specifies how a HTML or XML file will be formatted.
30  * <p>
31  * Use of certain options may be required when using certain document types
32  * in order to provide compatiblity for buggy or less capable browsers. Make
33  * sure to read the option descriptions and do your own testing to make sure
34  * these options are really necessary for use in your application...
35  * <dl>
36  * <dt>HTML</dt>
37  * <dd>{@link #setUseAposEntity oo.setUseAposEntity(false)}</dd>
38  * <dd>{@link #setOmitAttributeCharEntityRefs oo.setOmitAttributeCharEntityRefs(true)}</dd>
39  * <dd>{@link #setOmitDocType oo.setOmitDocType(false)} (html dom doesn't preserve doctype, so use this and two options below...)</dd>
40  * <dd>{@link #setPublicId oo.setPublicId(&quot;-//W3C//DTD HTML 4.01//EN&quot;)}</dd>
41  * <dd>{@link #setSystemId oo.setSystemId(&quot;http://www.w3.org/TR/html401/strict.dtd&quot;)}</dd>
42  * <dt>XHTML</dt>
43  * <dd>{@link #setEnableXHTMLCompatibility oo.setEnableXHTMLCompatibility(true)}</dd>
44  * <dd>{@link #setUseAposEntity oo.setUseAposEntity(false)}</dd>
45  * <dt>XML</dt>
46  * <dd>Overriding the defaults of most of these options is not recommended for pure XML and may cause output that doesn't strictly follow the XML spec and/or, in the worst case, invalid XML.</dd>
47  * </dl>
48  * </p>
49  * <p>
50  * Note: the pretty-printing options are not yet implemented by the
51  * formatters.</p>
52  */

53 public final class OutputOptions {
54     // N.B. Be sure to modify createCodeGenerator and toString if any fields
55
// are added or default values changed.
56

57     /**
58      * Desired output format enumerated type.
59      */

60     public static class Format {
61         /** Name of format */
62         private final String JavaDoc fName;
63
64         /** Constructor (package only) */
65         Format(String JavaDoc name) {
66             fName = name;
67         }
68
69         /** Get string name of format */
70         public String JavaDoc toString() {
71             return fName;
72         }
73     }
74
75     /**
76      * Constant indicating format should be determined automatically
77      * from examining the document object.
78      */

79     public static final Format FORMAT_AUTO = new Format("FORMAT_AUTO");
80
81     /**
82      * Constant indicating HTML format.
83      */

84     public static final Format FORMAT_HTML = new Format("FORMAT_HTML");
85
86     /**
87      * Constant indicating XML format.
88      */

89     public static final Format FORMAT_XML = new Format("FORMAT_XML");
90
91     /**
92      * The output file format to use.
93      */

94     private Format fFormat = FORMAT_AUTO;
95
96     /**
97      * The encoding to use.
98      */

99     private String JavaDoc fEncoding = null;
100
101     /**
102      * Whether the document be pretty-printed.
103      */

104     private boolean fPrettyPrinting = false;
105
106     /**
107      * Number of characters to indent if using pretty printing.
108      */

109     private int fIndentSize = 4;
110
111     /**
112      * Whether space is preserved where not otherwise specified by
113      * the document.
114      */

115     private boolean fPreserveSpace = true;
116
117     /**
118      * Whether to omit the XML header (for XML documents).
119      */

120     private boolean fOmitXMLHeader = false;
121
122     /**
123      * Whether to omit the DOCTYPE for either XML or HTML.
124      */

125     private boolean fOmitDocType = false;
126
127     /**
128      * Whether to omit the encoding in the XML header.
129      */

130     private boolean fOmitEncoding = false;
131
132     /**
133      * Whether id's on HTML &lt;span&gt; tags are removed
134      */

135     private boolean fDropHtmlSpanIds = false;
136
137     /**
138      * Whether to omit character entity references in attribute values.
139      */

140     private boolean fOmitAttributeCharEntityRefs = false;
141
142     /**
143      * The Rewriter for URL attribute values.
144      */

145     private URLRewriter fURLRewriter;
146
147     /**
148      * The public id to use in the DOCTYPE. Overrides the DocumentType.
149      */

150     private String JavaDoc fPublicId;
151
152     /**
153      * The system id to use in the DOCTYPE. Overrides the DocumentType.
154      */

155     private String JavaDoc fSystemId;
156
157     /**
158      * Optional MIME type for an output routine to use.
159      */

160     private String JavaDoc fMIMEType;
161
162     /**
163      * Whether to use internal XHTML compatibility workarounds.
164      *
165      * @see #setEnableXHTMLCompatibility()
166      */

167     private boolean fEnableXHTMLCompatibility = false;
168
169     /**
170      * Whether to use &amp;apos; to escape single quotes
171      */

172     private boolean fUseAposEntity = true;
173
174     /**
175      * Whether this object is read-only.
176      */

177     private boolean fReadOnly = false;
178
179     /**
180      * Whether to use named character entities for all entities found in HTML
181      * 4.0.
182      */

183     private boolean fUseHTML4Entities = false;
184
185     /**
186      * Construct with default values.
187      */

188     public OutputOptions() {
189     }
190
191     /**
192      * Copy constructor. The read-only property is not copied, the
193      * resulting object maybe modified.
194      */

195     public OutputOptions(OutputOptions src) {
196         fFormat = src.fFormat;
197         fEncoding = src.fEncoding;
198         fPrettyPrinting = src.fPrettyPrinting;
199         fIndentSize = src.fIndentSize;
200         fPreserveSpace = src.fPreserveSpace;
201         fOmitXMLHeader = src.fOmitXMLHeader;
202         fOmitDocType = src.fOmitDocType;
203         fOmitEncoding = src.fOmitEncoding;
204         fDropHtmlSpanIds = src.fDropHtmlSpanIds;
205         fOmitAttributeCharEntityRefs = src.fOmitAttributeCharEntityRefs;
206         fURLRewriter = src.fURLRewriter;
207         fPublicId = src.fPublicId;
208         fSystemId = src.fSystemId;
209         fMIMEType = src.fMIMEType;
210         fUseHTML4Entities = src.fUseHTML4Entities;
211         fEnableXHTMLCompatibility = src.fEnableXHTMLCompatibility;
212         fUseAposEntity = src.fUseAposEntity;
213     }
214
215     /**
216      * Validate that the object is writable.
217      */

218     private void readOnlyCheck() {
219         if (fReadOnly) {
220             throw new XMLIOError(OutputOptions.class.getName() + " object is marked as read-only");
221         }
222     }
223
224     /**
225      * Mark the object as read-only. Once made read-only, it may never be modified.
226      * If a modification is required, create a new object using the copy-constructor.
227      *
228      * @see #OutputOptions(OutputOptions)
229      */

230     public void markReadOnly() {
231         fReadOnly = true;
232     }
233
234     /**
235      * Set the output format for the file. Specifying an incorrect format
236      * will result in an invalid document. Default is FORMAT_AUTO,
237      * which determines the format from the DOM.
238      *
239      * @param format one of FORMAT_AUTO, FORMAT_HTML, FORMAT_XML
240      */

241     public void setFormat(Format format) {
242         readOnlyCheck();
243         fFormat = format;
244     }
245
246     /**
247      * Get the output format for the file.
248      *
249      * @return the output format
250      */

251     public Format getFormat() {
252         return fFormat;
253     }
254
255     /**
256      * Get the encoding.
257      *
258      * @return The encoding or null if not specified.
259      */

260     public String JavaDoc getEncoding() {
261         return fEncoding;
262     }
263
264     /**
265      * Set the encoding.
266      *
267      * @param encoding The new encoding, or null to clear.
268      */

269     public void setEncoding(String JavaDoc encoding) {
270         readOnlyCheck();
271         fEncoding = encoding;
272     }
273
274     /**
275      * Get the MIME encoding.
276      *
277      * @return The MIME-preferred name for the encoding, null if
278      * no encoding is specified.
279      */

280     public String JavaDoc getMIMEEncoding() {
281         if (fEncoding != null) {
282             String JavaDoc mimeEncoding = Encodings.getEncodings().getMIMEPreferred(fEncoding);
283             if (mimeEncoding != null) {
284                 return mimeEncoding;
285             }
286         }
287         return fEncoding;
288     }
289
290     /**
291      * Get use-apos-entity flag
292      *
293      * @return true if enabled, false if disabled. The default is enabled.
294      */

295     public boolean getUseAposEntity() {
296         return fUseAposEntity;
297     }
298
299     /**
300      * Enable or disable the use of &amp;apos; for escaping single quotes.
301      * <p>&amp;apos; was added in to the XML spec and doesn't exist in the
302      * HTML spec. As such, some browsers (some versions of IE) handle this
303      * poorly in attributes (think JavaScript). It is recommended that you
304      * disable the use of &amp;apos; entity if you run into problems. This
305      * option will, eventually, be unnecessary once more browsers provide
306      * support for the &amp;apos; entity.</p>
307      *
308      * @param enable true to enable, false to disable.
309      */

310     public void setUseAposEntity(boolean enable) {
311         readOnlyCheck();
312         fUseAposEntity = enable;
313     }
314
315     /**
316      * Get enable-xhtml-compatibility flag.
317      *
318      * @since 2.2
319      * @return true if enabled, false if disabled. The default is disabled.
320      */

321     public boolean getEnableXHTMLCompatibility() {
322         return fEnableXHTMLCompatibility;
323     }
324
325     /**
326      * Enable or disable XMLC XHTML compatibility workarounds
327      *
328      * <p>Many browsers still in heavy use
329      * don't fully support XHTML. In order to make the transition to XHTML,
330      * XMLC must allow for reasonable workarounds to known compatibility issues
331      * in these less capable browsers. Setting this flag to 'true' tells XMLC
332      * and, specifically, the XMLFormater to do anything it needs to maintain
333      * compatibility with older browsers. Currently, the following XHTML
334      * compatibility issues are accounted for:
335      * <ul>
336      * <li>{@link http://www.w3.org/TR/xhtml1/#C_2}</li>
337      * <li>{@link http://www.w3.org/TR/xhtml1/#C_3}</li>.
338      * </ul>
339      * This allows browsers, using an HTML parser, to render XHTML properly.
340      * It also allows IE 5.5 and IE6 to evaluate javascript properly, since
341      * said browsers fail to understand the minimized &lt;script ... /&gt;.</p>
342      *
343      * <p>Note that this method name is intentionally generic to allow for the
344      * application of other arbitrary workarounds without requiring new methods
345      * to be added to OutputOptions.</p>
346      *
347      * @since 2.2
348      * @param enable true to enable, false to disable
349      */

350     public void setEnableXHTMLCompatibility(boolean enable) {
351         readOnlyCheck();
352         fEnableXHTMLCompatibility = enable;
353     }
354
355     /**
356      * Get pretty-printing flag.
357      *
358      * @return true if enabled, false if disabled. The default is disabled.
359      */

360     public boolean getPrettyPrinting() {
361         return fPrettyPrinting;
362     }
363
364     /**
365      * Enable or disable pretty-printing.
366      *
367      * @param enable true to enable, false to disable
368      */

369     public void setPrettyPrinting(boolean enable) {
370         readOnlyCheck();
371         fPrettyPrinting = enable;
372     }
373
374     /**
375      * Get indentation size.
376      *
377      * @return Number of characters to indent at each level. The default is 4.
378      */

379     public int getIndentSize() {
380         return fIndentSize;
381     }
382
383     /**
384      * Set indentation size. Only used if pretty printing is enabled.
385      *
386      * @param size Number of characters to indent at each level.
387      */

388     public void setIndentSize(int size) {
389         readOnlyCheck();
390         fIndentSize = size;
391         if (fIndentSize < 0) {
392             fIndentSize = 0;
393         }
394     }
395
396     /**
397      * Get the default space-preservation flag.
398      *
399      * @return true if preserving space where not otherwise specified by
400      * the document, false otherwise. The default is true.
401      */

402     public boolean getPreserveSpace() {
403         return fPreserveSpace;
404     }
405
406     /**
407      * Set the default space-preservation flag.
408      *
409      * @param perserve true if preserving space where not otherwise specified
410      * by the document
411      */

412     public void setPreserveSpace(boolean preserve) {
413         readOnlyCheck();
414         fPreserveSpace = preserve;
415     }
416
417     /**
418      * Get flag indicating if the XML header should be omitted.
419      *
420      * @return true if omitted, false if admitted. The default is admitted.
421      */

422     public boolean getOmitXMLHeader() {
423         return fOmitXMLHeader;
424     }
425
426     /**
427      * Set flag indicating if the XML header should be omitted.
428      *
429      * @param omit true to omit, false to admit
430      */

431     public void setOmitXMLHeader(boolean omit) {
432         readOnlyCheck();
433         fOmitXMLHeader = omit;
434     }
435
436     /**
437      * Get flag indicating if the DOCTYPE should be omitted.
438      *
439      * @return true if omitted, false if admitted. The default is admitted.
440      */

441     public boolean getOmitDocType() {
442         return fOmitDocType;
443     }
444
445     /**
446      * Set flag indicating if the DOCTYPE should be omitted.
447      *
448      * @param omit true to omit, false to admit
449      */

450     public void setOmitDocType(boolean omit) {
451         readOnlyCheck();
452         fOmitDocType = omit;
453     }
454
455     /**
456      * Get flag indicating if encoding should be omitted from the XML header.
457      *
458      * @return true if omitted, false if admitted. The default is admitted.
459      */

460     public boolean getOmitEncoding() {
461         return fOmitEncoding;
462     }
463
464     /**
465      * Set flag indicating if encoding should be omitted from the XML header.
466      * This is provided as a hack for WML. Several devices need ASCII
467      * encoding but can't handle the header.
468      *
469      * @param omit true to omit, false to admit
470      */

471     public void setOmitEncoding(boolean omit) {
472         readOnlyCheck();
473         fOmitEncoding = omit;
474     }
475
476     /**
477      * Get the drop HTML SPAN element ids flag.
478      *
479      * @return true if dropped, false if kept. The default is kept.
480      */

481     public boolean getDropHtmlSpanIds() {
482         return fDropHtmlSpanIds;
483     }
484
485     /**
486      * Set the drop HTML &lt;span&gt; element id's flag.
487      * <p>MS Internet Explorer 4.0 gets very confused about keep-alive
488      * connections if HTML &lt;span&gt; tags have &quot;id&quot; attributes.
489      * Until we find another workaround, this removes &quot;id&quot;'s from
490      * &lt;span&gt; tags.</p>
491      * <p>Unless you have to support IE4 users and require keep-alive
492      * connections to your application, this option is not recommended</p>
493      *
494      * @param drop true to drop, false to keep
495      */

496     public void setDropHtmlSpanIds(boolean drop) {
497         readOnlyCheck();
498         fDropHtmlSpanIds = drop;
499     }
500
501     /**
502      * Get value of flag that enables or disables the use of character entity
503      * references in attribute values.
504      *
505      * @return true if omitted, false if admitted. The default is admitted.
506      */

507     public boolean getOmitAttributeCharEntityRefs() {
508         return fOmitAttributeCharEntityRefs;
509     }
510
511     /**
512      * Set value of flag that enables or disables the use of character entity
513      * references in attribute values.
514      * <p>By default, all standard character
515      * entity references are used in attribute values. While this is legal in
516      * HTML and XML, some HTML clients may not handle this well
517      * (for instance, one of the major browsers didn't correctly expand the
518      * entity references in PARAM values passed to applets).
519      * If this flag is set, then standard character entity
520      * references (such as &amp;amp;) will not be substituted. Numeric
521      * character entity references will still be substituted for quotes and
522      * for characters that can't be represented in the encoding.</p>
523      * <p>This option is not recommended for XML and should be avoided in any
524      * case unless this issue becomes a problem in your application.</p>
525      *
526      * @param omit true to omit, false to admit
527      * @see #getOmitAttributeCharEntityRefs()
528      */

529     public void setOmitAttributeCharEntityRefs(boolean omit) {
530         fOmitAttributeCharEntityRefs = omit;
531     }
532
533     /**
534      * Set the URLRewriter that all URL attributes will be passed through.
535      * Documents must implement DocumentInfo for the URL rewriter to
536      * work.
537      * <BR>
538      * Note: URL rewriting curret only works when the XMLC document
539      * object is passed to the formatter. Passing the contained document or
540      * any other node results in no URL rewriting.
541      *
542      * @param urlRewriter The URLRewriter object, or null to disassociate
543      * any URL rewriter.
544      * @see DocumentInfo
545      */

546     public void setURLRewriter(URLRewriter urlRewriter) {
547         readOnlyCheck();
548         fURLRewriter = urlRewriter;
549     }
550
551     /**
552      * Get the URLRewriter.
553      *
554      * @return The URLRewriter object.
555      * @see DocumentInfo
556      */

557     public URLRewriter getURLRewriter() {
558         return fURLRewriter;
559     }
560
561     /**
562      * Get the public id to be used in the DOCUMENT.
563      *
564      * @return the public id
565      */

566     public String JavaDoc getPublicId() {
567         return fPublicId;
568     }
569
570     /**
571      * Set the public id to use in the DOCUMENT. This overrides the
572      * default value determined from the DocumentType.
573      *
574      * @return the public id
575      */

576     public void setPublicId(String JavaDoc publicId) {
577         readOnlyCheck();
578         fPublicId = publicId;
579     }
580
581     /**
582      * Get the system id to be used in the DOCUMENT.
583      *
584      * @return the system id
585      */

586     public String JavaDoc getSystemId() {
587         return fSystemId;
588     }
589
590     /**
591      * Set the system id to use in the DOCUMENT. This overrides the
592      * default value determined from the DocumentType.
593      *
594      * @return the system id
595      */

596     public void setSystemId(String JavaDoc systemId) {
597         readOnlyCheck();
598         fSystemId = systemId;
599     }
600
601     /**
602      * Get the MIME for an output routine to use.
603      *
604      * @return The overriding MIME type, null if one was not specified.
605      */

606     public String JavaDoc getMIMEType() {
607         return fMIMEType;
608     }
609
610     /**
611      * Set the MIME for an output routine to use. This is stored in this
612      * object for use by output routines, DOMFormatters don't actually use it.
613      * It is normally used to override the default MIME type that would be
614      * stored in the XMLObject.
615      *
616      * @param mimeType the mime-type to use
617      */

618     public void setMIMEType(String JavaDoc mimeType) {
619         readOnlyCheck();
620         fMIMEType = mimeType;
621     }
622
623     /**
624      * Generate code to set a String property.
625      */

626     private void genSet(String JavaDoc varName,
627                         JavaCode code,
628                         String JavaDoc setMethod,
629                         String JavaDoc value) {
630         code.addln(varName + "." + setMethod + "("
631                    + JavaLang.createStringConst(value) + ");");
632     }
633
634     /**
635      * Generate code to set a boolean property.
636      */

637     private void genSet(String JavaDoc varName,
638                         JavaCode code,
639                         String JavaDoc setMethod,
640                         boolean value) {
641         code.addln(varName + "." + setMethod + "("
642                    + (value ? "true" : "false") + ");");
643     }
644
645     /**
646      * Generate code to set an int property.
647      */

648     private void genSet(String JavaDoc varName,
649                         JavaCode code,
650                         String JavaDoc setMethod,
651                         int value) {
652         code.addln(varName + "." + setMethod + "("
653                    + Integer.toString(value) + ");");
654     }
655
656     /**
657      * Generate code to create an object with the same attributes as this
658      * object.
659      * <P>
660      * The following attributes are not generated in the new code:
661      * <UL>
662      * <LI> readOnly - Set to the value of the makeReadOnly parameter.
663      * <LI> urlRewriter
664      * </UL>
665      *
666      * @param varName Variable or field name of variable to store
667      * the object in. It must already be declared.
668      * @param makeReadOnly Should the created object be made read-only?
669      * @param code Add generated code to this object.
670      */

671     public void createCodeGenerator(String JavaDoc varName,
672                                     boolean makeReadOnly,
673                                     JavaCode code) {
674         //FIXME: Change to only generate code if not default
675
code.addln(varName + " = new " + OutputOptions.class.getName() + "();");
676         code.addln(varName + ".setFormat("
677                    + OutputOptions.class.getName()
678                    + "." + fFormat.toString() + ");");
679
680         // Java encoding set by setting XML encoding
681
genSet(varName, code, "setEncoding", fEncoding);
682         genSet(varName, code, "setPrettyPrinting", fPrettyPrinting);
683         genSet(varName, code, "setEnableXHTMLCompatibility", fEnableXHTMLCompatibility);
684         genSet(varName, code, "setUseAposEntity", fUseAposEntity);
685         genSet(varName, code, "setIndentSize", fIndentSize);
686         genSet(varName, code, "setPreserveSpace", fPreserveSpace);
687         genSet(varName, code, "setOmitXMLHeader", fOmitXMLHeader);
688         genSet(varName, code, "setOmitDocType", fOmitDocType);
689         genSet(varName, code, "setOmitEncoding", fOmitEncoding);
690         genSet(varName, code, "setDropHtmlSpanIds", fDropHtmlSpanIds);
691         genSet(varName, code, "setOmitAttributeCharEntityRefs", fOmitAttributeCharEntityRefs);
692         genSet(varName, code, "setPublicId", fPublicId);
693         genSet(varName, code, "setSystemId", fSystemId);
694         genSet(varName, code, "setMIMEType", fMIMEType);
695         if (makeReadOnly) {
696             code.addln(varName + ".markReadOnly();");
697         }
698     }
699
700     /**
701      * Convert to a string for debugging.
702      */

703     public String JavaDoc toString() {
704         return "readOnly=" + fReadOnly
705             + ", format=" + fFormat
706             + ", encoding=" + fEncoding
707             + ", prettyPrinting=" + fPrettyPrinting
708             + ", useAposEntity=" + fUseAposEntity
709             + ", enableXHTMLCompatibility=" + fEnableXHTMLCompatibility
710             + ", indentSize=" + fIndentSize
711             + ", preserveSpace=" + fPreserveSpace
712             + ", omitXMLHeader=" + fOmitXMLHeader
713             + ", omitDocType=" + fOmitDocType
714             + ", omitEncoding=" + fOmitEncoding
715             + ", dropHtmlSpanIds=" + fDropHtmlSpanIds
716             + ", omitAttributeCharEntityRefs=" + fOmitAttributeCharEntityRefs
717             + ", urlRewriter=" + fURLRewriter
718             + ", publicId=" + fPublicId
719             + ", systemId=" + fSystemId
720             + ", mimeType=" + fMIMEType;
721     }
722
723     /**
724      * Get the encoding.
725      *
726      * @deprecated Use <tt>getEncoding()</tt> or <tt>getMIMEEncoding()</tt>.
727      * @see #getEncoding
728      * @see #getMIMEEncoding
729      */

730     public String JavaDoc getJavaEncoding() {
731         return getEncoding();
732     }
733
734     /**
735      * Set the encoding.
736      *
737      * @deprecated Use <tt>setEncoding()</tt>.
738      * @see #setEncoding
739      */

740     public void setJavaEncoding(String JavaDoc newJavaEncoding) {
741         setEncoding(newJavaEncoding);
742     }
743
744     /**
745      * Get the MIME-preferred encoding.
746      *
747      * @deprecated Use <tt>getMIMEEncoding()</tt>.
748      * @see #getMIMEEncoding
749      */

750     public String JavaDoc getXmlEncoding() {
751         return getMIMEEncoding();
752     }
753
754     /**
755      * Set the encoding.
756      *
757      * @deprecated Use <tt>setEncoding()</tt>.
758      */

759     public void setXmlEncoding(String JavaDoc newXmlEncoding) {
760         setEncoding(newXmlEncoding);
761     }
762
763     /**
764      * Get the flag telling whether to use named entities from HTML 4.0 or
765      * not.
766      *
767      * @return true if enabled, false if disabled. The default is disabled.
768      */

769     public boolean getUseHTML4Entities() {
770         return fUseHTML4Entities;
771     }
772
773     /**
774      * Set the flag telling whether to use named entities from HTML 4.0 or
775      * not.
776      *
777      * @param useHTML4Entities true to enable, false to disable
778      */

779     public void setUseHTML4Entities(boolean useHTML4Entities) {
780         fUseHTML4Entities = useHTML4Entities;
781     }
782
783 }
784
Popular Tags