1 /*
2  * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * This code is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 only, as
7  * published by the Free Software Foundation.  Oracle designates this
8  * particular file as subject to the "Classpath" exception as provided
9  * by Oracle in the LICENSE file that accompanied this code.
10  *
11  * This code is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14  * version 2 for more details (a copy is included in the LICENSE file that
15  * accompanied this code).
16  *
17  * You should have received a copy of the GNU General Public License version
18  * 2 along with this work; if not, write to the Free Software Foundation,
19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20  *
21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22  * or visit www.oracle.com if you need additional information or have any
23  * questions.
24  */
25 
26 package javax.xml.transform;
27 
28 /**
29  * Provides string constants that can be used to set
30  * output properties for a Transformer, or to retrieve
31  * output properties from a Transformer or Templates object.
32  * <p>All the fields in this class are read-only.</p>
33  *
34  * @see <a href="http://www.w3.org/TR/xslt#output">
35  *  section 16 of the XSL Transformations (XSLT) W3C Recommendation</a>
36  * @since 1.4
37  */
38 public class OutputKeys {
39 
40     /**
41      * Default constructor is private on purpose.  This class is
42      * only for static variable access, and should never be constructed.
43      */
OutputKeys()44     private OutputKeys() { }
45 
46     /**
47      * method = "xml" | "html" | "text" | <var>expanded name</var>.
48      *
49      * <p>The value of the method property identifies the overall method that
50      * should be used for outputting the result tree.  Other non-namespaced
51      * values may be used, such as "xhtml", but, if accepted, the handling
52      * of such values is implementation defined.  If any of the method values
53      * are not accepted and are not namespace qualified,
54      * then {@link javax.xml.transform.Transformer#setOutputProperty}
55      * or {@link javax.xml.transform.Transformer#setOutputProperties} will
56      * throw a {@link java.lang.IllegalArgumentException}.</p>
57      *
58      * @see <a href="http://www.w3.org/TR/xslt#output">
59      *  section 16 of the XSL Transformations (XSLT) W3C Recommendation</a>
60      */
61     public static final String METHOD = "method";
62 
63     /**
64      * version = <var>nmtoken</var>.
65      *
66      * <p><code>version</code> specifies the version of the output
67      * method.</p>
68      * <p>When the output method is "xml", the version value specifies the
69      * version of XML to be used for outputting the result tree. The default
70      * value for the xml output method is 1.0. When the output method is
71      * "html", the version value indicates the version of the HTML.
72      * The default value for the xml output method is 4.0, which specifies
73      * that the result should be output as HTML conforming to the HTML 4.0
74      * Recommendation [HTML].  If the output method is "text", the version
75      * property is ignored.</p>
76      * @see <a href="http://www.w3.org/TR/xslt#output">
77      *  section 16 of the XSL Transformations (XSLT) W3C Recommendation</a>
78      */
79     public static final String VERSION = "version";
80 
81     /**
82      * encoding = <var>string</var>.
83      *
84      * <p><code>encoding</code> specifies the preferred character
85      * encoding that the Transformer should use to encode sequences of
86      * characters as sequences of bytes. The value of the encoding property should be
87      * treated case-insensitively. The value must only contain characters in
88      * the range #x21 to #x7E (i.e., printable ASCII characters). The value
89      * should either be a <code>charset</code> registered with the Internet
90      * Assigned Numbers Authority <a href="http://www.iana.org/">[IANA]</a>,
91      * <a href="http://www.ietf.org/rfc/rfc2278.txt">[RFC2278]</a>
92      * or start with <code>X-</code>.</p>
93      * @see <a href="http://www.w3.org/TR/xslt#output">
94      * section 16 of the XSL Transformations (XSLT) W3C Recommendation</a>
95      */
96     public static final String ENCODING = "encoding";
97 
98     /**
99      * omit-xml-declaration = "yes" | "no".
100      *
101      * <p><code>omit-xml-declaration</code> specifies whether the XSLT
102      * processor should output an XML declaration; the value must be
103      * <code>yes</code> or <code>no</code>.</p>
104      * @see <a href="http://www.w3.org/TR/xslt#output">
105      *  section 16 of the XSL Transformations (XSLT) W3C Recommendation</a>
106      */
107     public static final String OMIT_XML_DECLARATION = "omit-xml-declaration";
108 
109     /**
110      * standalone = "yes" | "no".
111      *
112      * <p><code>standalone</code> specifies whether the Transformer
113      * should output a standalone document declaration; the value must be
114      * <code>yes</code> or <code>no</code>.</p>
115      * @see <a href="http://www.w3.org/TR/xslt#output">
116      *  section 16 of the XSL Transformations (XSLT) W3C Recommendation</a>
117      */
118     public static final String STANDALONE = "standalone";
119 
120     /**
121      * doctype-public = <var>string</var>.
122      * <p>See the documentation for the {@link #DOCTYPE_SYSTEM} property
123      * for a description of what the value of the key should be.</p>
124      *
125      * @see <a href="http://www.w3.org/TR/xslt#output">
126      *  section 16 of the XSL Transformations (XSLT) W3C Recommendation</a>
127      */
128     public static final String DOCTYPE_PUBLIC = "doctype-public";
129 
130     /**
131      * doctype-system = <var>string</var>.
132      * <p><code>doctype-system</code> specifies the system identifier
133      * to be used in the document type declaration.</p>
134      * <p>If the doctype-system property is specified, the xml output method
135      * should output a document type declaration immediately before the first
136      * element. The name following &lt;!DOCTYPE should be the name of the first
137      * element. If doctype-public property is also specified, then the xml
138      * output method should output PUBLIC followed by the public identifier
139      * and then the system identifier; otherwise, it should output SYSTEM
140      * followed by the system identifier. The internal subset should be empty.
141      * The value of the doctype-public property should be ignored unless the doctype-system
142      * property is specified.</p>
143      * <p>If the doctype-public or doctype-system properties are specified,
144      * then the html output method should output a document type declaration
145      * immediately before the first element. The name following &lt;!DOCTYPE
146      * should be HTML or html. If the doctype-public property is specified,
147      * then the output method should output PUBLIC followed by the specified
148      * public identifier; if the doctype-system property is also specified,
149      * it should also output the specified system identifier following the
150      * public identifier. If the doctype-system property is specified but
151      * the doctype-public property is not specified, then the output method
152      * should output SYSTEM followed by the specified system identifier.</p>
153      *
154      * <p><code>doctype-system</code> specifies the system identifier
155      * to be used in the document type declaration.</p>
156      * @see <a href="http://www.w3.org/TR/xslt#output">
157      *  section 16 of the XSL Transformations (XSLT) W3C Recommendation</a>
158      */
159     public static final String DOCTYPE_SYSTEM = "doctype-system";
160 
161     /**
162      * cdata-section-elements = <var>expanded names</var>.
163      *
164      * <p><code>cdata-section-elements</code> specifies a whitespace delimited
165      * list of the names of elements whose text node children should be output
166      * using CDATA sections. Note that these names must use the format
167      * described in the section Qualfied Name Representation in
168      * {@link javax.xml.transform}.</p>
169      *
170      * @see <a href="http://www.w3.org/TR/xslt#output">
171      *  section 16 of the XSL Transformations (XSLT) W3C Recommendation.</a>
172      */
173     public static final String CDATA_SECTION_ELEMENTS =
174         "cdata-section-elements";
175 
176     /**
177      * indent = "yes" | "no".
178      *
179      * <p><code>indent</code> specifies whether the Transformer may
180      * add additional whitespace when outputting the result tree; the value
181      * must be <code>yes</code> or <code>no</code>.  </p>
182      * @see <a href="http://www.w3.org/TR/xslt#output">
183      *  section 16 of the XSL Transformations (XSLT) W3C Recommendation</a>
184      */
185     public static final String INDENT = "indent";
186 
187     /**
188      * media-type = <var>string</var>.
189      *
190      * <p><code>media-type</code> specifies the media type (MIME
191      * content type) of the data that results from outputting the result
192      * tree. The <code>charset</code> parameter should not be specified
193      * explicitly; instead, when the top-level media type is
194      * <code>text</code>, a <code>charset</code> parameter should be added
195      * according to the character encoding actually used by the output
196      * method.  </p>
197      * @see <a href="http://www.w3.org/TR/xslt#output">s
198      * ection 16 of the XSL Transformations (XSLT) W3C Recommendation</a>
199      */
200     public static final String MEDIA_TYPE = "media-type";
201 }
202