jaxp/src/share/classes/javax/xml/transform/Transformer.java
author ohair
Mon, 14 Apr 2008 14:52:27 -0700
changeset 311 3c14f21bf3f7
parent 6 7f561c08de6b
permissions -rw-r--r--
6484686: The next directory looks like it is no longer part of the build (deploy makefiles) Summary: Getting rid of the _OUTPUTDIR settings. Using BUILD_PARENT_DIRECTORY instead. This solves problems with the "/build/windows-i586*" paths getting mangled on Windows builds (fastdebug builds in particular). Reviewed-by: tbell
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6
7f561c08de6b Initial load
duke
parents:
diff changeset
     1
/*
7f561c08de6b Initial load
duke
parents:
diff changeset
     2
 * Copyright 2000-2005 Sun Microsystems, Inc.  All Rights Reserved.
7f561c08de6b Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7f561c08de6b Initial load
duke
parents:
diff changeset
     4
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
7f561c08de6b Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
7f561c08de6b Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
7f561c08de6b Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
7f561c08de6b Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
7f561c08de6b Initial load
duke
parents:
diff changeset
    10
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
7f561c08de6b Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
7f561c08de6b Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
7f561c08de6b Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
7f561c08de6b Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
7f561c08de6b Initial load
duke
parents:
diff changeset
    16
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
7f561c08de6b Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
7f561c08de6b Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
7f561c08de6b Initial load
duke
parents:
diff changeset
    20
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
7f561c08de6b Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
7f561c08de6b Initial load
duke
parents:
diff changeset
    23
 * have any questions.
7f561c08de6b Initial load
duke
parents:
diff changeset
    24
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    25
7f561c08de6b Initial load
duke
parents:
diff changeset
    26
package javax.xml.transform;
7f561c08de6b Initial load
duke
parents:
diff changeset
    27
7f561c08de6b Initial load
duke
parents:
diff changeset
    28
import java.util.Properties;
7f561c08de6b Initial load
duke
parents:
diff changeset
    29
7f561c08de6b Initial load
duke
parents:
diff changeset
    30
/**
7f561c08de6b Initial load
duke
parents:
diff changeset
    31
 * An instance of this abstract class can transform a
7f561c08de6b Initial load
duke
parents:
diff changeset
    32
 * source tree into a result tree.
7f561c08de6b Initial load
duke
parents:
diff changeset
    33
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    34
 * <p>An instance of this class can be obtained with the
7f561c08de6b Initial load
duke
parents:
diff changeset
    35
 * {@link TransformerFactory#newTransformer TransformerFactory.newTransformer}
7f561c08de6b Initial load
duke
parents:
diff changeset
    36
 * method. This instance may then be used to process XML from a
7f561c08de6b Initial load
duke
parents:
diff changeset
    37
 * variety of sources and write the transformation output to a
7f561c08de6b Initial load
duke
parents:
diff changeset
    38
 * variety of sinks.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
    39
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    40
 * <p>An object of this class may not be used in multiple threads
7f561c08de6b Initial load
duke
parents:
diff changeset
    41
 * running concurrently.  Different Transformers may be used
7f561c08de6b Initial load
duke
parents:
diff changeset
    42
 * concurrently by different threads.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
    43
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    44
 * <p>A <code>Transformer</code> may be used multiple times.  Parameters and
7f561c08de6b Initial load
duke
parents:
diff changeset
    45
 * output properties are preserved across transformations.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
    46
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    47
 * @author <a href="Jeff.Suttor@Sun.com">Jeff Suttor</a>
7f561c08de6b Initial load
duke
parents:
diff changeset
    48
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    49
public abstract class Transformer {
7f561c08de6b Initial load
duke
parents:
diff changeset
    50
7f561c08de6b Initial load
duke
parents:
diff changeset
    51
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    52
     * Default constructor is protected on purpose.
7f561c08de6b Initial load
duke
parents:
diff changeset
    53
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
    54
    protected Transformer() { }
7f561c08de6b Initial load
duke
parents:
diff changeset
    55
7f561c08de6b Initial load
duke
parents:
diff changeset
    56
        /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    57
         * <p>Reset this <code>Transformer</code> to its original configuration.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
    58
         *
7f561c08de6b Initial load
duke
parents:
diff changeset
    59
         * <p><code>Transformer</code> is reset to the same state as when it was created with
7f561c08de6b Initial load
duke
parents:
diff changeset
    60
         * {@link TransformerFactory#newTransformer()},
7f561c08de6b Initial load
duke
parents:
diff changeset
    61
         * {@link TransformerFactory#newTransformer(Source source)} or
7f561c08de6b Initial load
duke
parents:
diff changeset
    62
         * {@link Templates#newTransformer()}.
7f561c08de6b Initial load
duke
parents:
diff changeset
    63
         * <code>reset()</code> is designed to allow the reuse of existing <code>Transformer</code>s
7f561c08de6b Initial load
duke
parents:
diff changeset
    64
         * thus saving resources associated with the creation of new <code>Transformer</code>s.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
    65
         *
7f561c08de6b Initial load
duke
parents:
diff changeset
    66
         * <p>The reset <code>Transformer</code> is not guaranteed to have the same {@link URIResolver}
7f561c08de6b Initial load
duke
parents:
diff changeset
    67
         * or {@link ErrorListener} <code>Object</code>s, e.g. {@link Object#equals(Object obj)}.
7f561c08de6b Initial load
duke
parents:
diff changeset
    68
         * It is guaranteed to have a functionally equal <code>URIResolver</code>
7f561c08de6b Initial load
duke
parents:
diff changeset
    69
         * and <code>ErrorListener</code>.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
    70
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
    71
     * @throws UnsupportedOperationException When implementation does not
7f561c08de6b Initial load
duke
parents:
diff changeset
    72
     *   override this method.
7f561c08de6b Initial load
duke
parents:
diff changeset
    73
         *
7f561c08de6b Initial load
duke
parents:
diff changeset
    74
         * @since 1.5
7f561c08de6b Initial load
duke
parents:
diff changeset
    75
         */
7f561c08de6b Initial load
duke
parents:
diff changeset
    76
        public void reset() {
7f561c08de6b Initial load
duke
parents:
diff changeset
    77
7f561c08de6b Initial load
duke
parents:
diff changeset
    78
                // implementors should override this method
7f561c08de6b Initial load
duke
parents:
diff changeset
    79
                throw new UnsupportedOperationException(
7f561c08de6b Initial load
duke
parents:
diff changeset
    80
                        "This Transformer, \"" + this.getClass().getName() + "\", does not support the reset functionality."
7f561c08de6b Initial load
duke
parents:
diff changeset
    81
                        + "  Specification \"" + this.getClass().getPackage().getSpecificationTitle() + "\""
7f561c08de6b Initial load
duke
parents:
diff changeset
    82
                        + " version \"" + this.getClass().getPackage().getSpecificationVersion() + "\""
7f561c08de6b Initial load
duke
parents:
diff changeset
    83
                        );
7f561c08de6b Initial load
duke
parents:
diff changeset
    84
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
    85
7f561c08de6b Initial load
duke
parents:
diff changeset
    86
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
    87
     * <p>Transform the XML <code>Source</code> to a <code>Result</code>.
7f561c08de6b Initial load
duke
parents:
diff changeset
    88
     * Specific transformation behavior is determined by the settings of the
7f561c08de6b Initial load
duke
parents:
diff changeset
    89
     * <code>TransformerFactory</code> in effect when the
7f561c08de6b Initial load
duke
parents:
diff changeset
    90
     * <code>Transformer</code> was instantiated and any modifications made to
7f561c08de6b Initial load
duke
parents:
diff changeset
    91
     * the <code>Transformer</code> instance.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
    92
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
    93
     * <p>An empty <code>Source</code> is represented as an empty document
7f561c08de6b Initial load
duke
parents:
diff changeset
    94
     * as constructed by {@link javax.xml.parsers.DocumentBuilder#newDocument()}.
7f561c08de6b Initial load
duke
parents:
diff changeset
    95
     * The result of transforming an empty <code>Source</code> depends on
7f561c08de6b Initial load
duke
parents:
diff changeset
    96
     * the transformation behavior; it is not always an empty
7f561c08de6b Initial load
duke
parents:
diff changeset
    97
     * <code>Result</code>.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
    98
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
    99
     * @param xmlSource The XML input to transform.
7f561c08de6b Initial load
duke
parents:
diff changeset
   100
     * @param outputTarget The <code>Result</code> of transforming the
7f561c08de6b Initial load
duke
parents:
diff changeset
   101
     *   <code>xmlSource</code>.
7f561c08de6b Initial load
duke
parents:
diff changeset
   102
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   103
     * @throws TransformerException If an unrecoverable error occurs
7f561c08de6b Initial load
duke
parents:
diff changeset
   104
     *   during the course of the transformation.
7f561c08de6b Initial load
duke
parents:
diff changeset
   105
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   106
    public abstract void transform(Source xmlSource, Result outputTarget)
7f561c08de6b Initial load
duke
parents:
diff changeset
   107
        throws TransformerException;
7f561c08de6b Initial load
duke
parents:
diff changeset
   108
7f561c08de6b Initial load
duke
parents:
diff changeset
   109
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   110
     * Add a parameter for the transformation.
7f561c08de6b Initial load
duke
parents:
diff changeset
   111
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   112
     * <p>Pass a qualified name as a two-part string, the namespace URI
7f561c08de6b Initial load
duke
parents:
diff changeset
   113
     * enclosed in curly braces ({}), followed by the local name. If the
7f561c08de6b Initial load
duke
parents:
diff changeset
   114
     * name has a null URL, the String only contain the local name. An
7f561c08de6b Initial load
duke
parents:
diff changeset
   115
     * application can safely check for a non-null URI by testing to see if the
7f561c08de6b Initial load
duke
parents:
diff changeset
   116
     * first character of the name is a '{' character.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   117
     * <p>For example, if a URI and local name were obtained from an element
7f561c08de6b Initial load
duke
parents:
diff changeset
   118
     * defined with &lt;xyz:foo
7f561c08de6b Initial load
duke
parents:
diff changeset
   119
     * xmlns:xyz="http://xyz.foo.com/yada/baz.html"/&gt;,
7f561c08de6b Initial load
duke
parents:
diff changeset
   120
     * then the qualified name would be "{http://xyz.foo.com/yada/baz.html}foo".
7f561c08de6b Initial load
duke
parents:
diff changeset
   121
     * Note that no prefix is used.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   122
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   123
     * @param name The name of the parameter, which may begin with a
7f561c08de6b Initial load
duke
parents:
diff changeset
   124
     * namespace URI in curly braces ({}).
7f561c08de6b Initial load
duke
parents:
diff changeset
   125
     * @param value The value object.  This can be any valid Java object. It is
7f561c08de6b Initial load
duke
parents:
diff changeset
   126
     * up to the processor to provide the proper object coersion or to simply
7f561c08de6b Initial load
duke
parents:
diff changeset
   127
     * pass the object on for use in an extension.
7f561c08de6b Initial load
duke
parents:
diff changeset
   128
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   129
     * @throws NullPointerException If value is null.
7f561c08de6b Initial load
duke
parents:
diff changeset
   130
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   131
     public abstract void setParameter(String name, Object value);
7f561c08de6b Initial load
duke
parents:
diff changeset
   132
7f561c08de6b Initial load
duke
parents:
diff changeset
   133
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   134
     * Get a parameter that was explicitly set with setParameter.
7f561c08de6b Initial load
duke
parents:
diff changeset
   135
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   136
     * <p>This method does not return a default parameter value, which
7f561c08de6b Initial load
duke
parents:
diff changeset
   137
     * cannot be determined until the node context is evaluated during
7f561c08de6b Initial load
duke
parents:
diff changeset
   138
     * the transformation process.
7f561c08de6b Initial load
duke
parents:
diff changeset
   139
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   140
     * @param name of <code>Object</code> to get
7f561c08de6b Initial load
duke
parents:
diff changeset
   141
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   142
     * @return A parameter that has been set with setParameter.
7f561c08de6b Initial load
duke
parents:
diff changeset
   143
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   144
    public abstract Object getParameter(String name);
7f561c08de6b Initial load
duke
parents:
diff changeset
   145
7f561c08de6b Initial load
duke
parents:
diff changeset
   146
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   147
     * <p>Set a list of parameters.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   148
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   149
     * <p>Note that the list of parameters is specified as a
7f561c08de6b Initial load
duke
parents:
diff changeset
   150
     * <code>Properties</code> <code>Object</code> which limits the parameter
7f561c08de6b Initial load
duke
parents:
diff changeset
   151
     * values to <code>String</code>s.  Multiple calls to
7f561c08de6b Initial load
duke
parents:
diff changeset
   152
     * {@link #setParameter(String name, Object value)} should be used when the
7f561c08de6b Initial load
duke
parents:
diff changeset
   153
     * desired values are non-<code>String</code> <code>Object</code>s.
7f561c08de6b Initial load
duke
parents:
diff changeset
   154
     * The parameter names should conform as specified in
7f561c08de6b Initial load
duke
parents:
diff changeset
   155
     * {@link #setParameter(String name, Object value)}.
7f561c08de6b Initial load
duke
parents:
diff changeset
   156
     * An <code>IllegalArgumentException</code> is thrown if any names do not
7f561c08de6b Initial load
duke
parents:
diff changeset
   157
     * conform.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   158
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   159
     * <p>New parameters in the list are added to any existing parameters.
7f561c08de6b Initial load
duke
parents:
diff changeset
   160
     * If the name of a new parameter is equal to the name of an existing
7f561c08de6b Initial load
duke
parents:
diff changeset
   161
     * parameter as determined by {@link java.lang.Object#equals(Object obj)},
7f561c08de6b Initial load
duke
parents:
diff changeset
   162
     *  the existing parameter is set to the new value.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   163
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   164
     * @param params Parameters to set.
7f561c08de6b Initial load
duke
parents:
diff changeset
   165
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   166
     * @throws IllegalArgumentException If any parameter names do not conform
7f561c08de6b Initial load
duke
parents:
diff changeset
   167
     *   to the naming rules.
7f561c08de6b Initial load
duke
parents:
diff changeset
   168
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   169
7f561c08de6b Initial load
duke
parents:
diff changeset
   170
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   171
     * Clear all parameters set with setParameter.
7f561c08de6b Initial load
duke
parents:
diff changeset
   172
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   173
    public abstract void clearParameters();
7f561c08de6b Initial load
duke
parents:
diff changeset
   174
7f561c08de6b Initial load
duke
parents:
diff changeset
   175
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   176
     * Set an object that will be used to resolve URIs used in
7f561c08de6b Initial load
duke
parents:
diff changeset
   177
     * document().
7f561c08de6b Initial load
duke
parents:
diff changeset
   178
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   179
     * <p>If the resolver argument is null, the URIResolver value will
7f561c08de6b Initial load
duke
parents:
diff changeset
   180
     * be cleared and the transformer will no longer have a resolver.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   181
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   182
     * @param resolver An object that implements the URIResolver interface,
7f561c08de6b Initial load
duke
parents:
diff changeset
   183
     * or null.
7f561c08de6b Initial load
duke
parents:
diff changeset
   184
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   185
    public abstract void setURIResolver(URIResolver resolver);
7f561c08de6b Initial load
duke
parents:
diff changeset
   186
7f561c08de6b Initial load
duke
parents:
diff changeset
   187
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   188
     * Get an object that will be used to resolve URIs used in
7f561c08de6b Initial load
duke
parents:
diff changeset
   189
     * document().
7f561c08de6b Initial load
duke
parents:
diff changeset
   190
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   191
     * @return An object that implements the URIResolver interface,
7f561c08de6b Initial load
duke
parents:
diff changeset
   192
     * or null.
7f561c08de6b Initial load
duke
parents:
diff changeset
   193
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   194
    public abstract URIResolver getURIResolver();
7f561c08de6b Initial load
duke
parents:
diff changeset
   195
7f561c08de6b Initial load
duke
parents:
diff changeset
   196
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   197
     * Set the output properties for the transformation.  These
7f561c08de6b Initial load
duke
parents:
diff changeset
   198
     * properties will override properties set in the Templates
7f561c08de6b Initial load
duke
parents:
diff changeset
   199
     * with xsl:output.
7f561c08de6b Initial load
duke
parents:
diff changeset
   200
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   201
     * <p>If argument to this function is null, any properties
7f561c08de6b Initial load
duke
parents:
diff changeset
   202
     * previously set are removed, and the value will revert to the value
7f561c08de6b Initial load
duke
parents:
diff changeset
   203
     * defined in the templates object.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   204
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   205
     * <p>Pass a qualified property key name as a two-part string, the namespace
7f561c08de6b Initial load
duke
parents:
diff changeset
   206
     * URI enclosed in curly braces ({}), followed by the local name. If the
7f561c08de6b Initial load
duke
parents:
diff changeset
   207
     * name has a null URL, the String only contain the local name. An
7f561c08de6b Initial load
duke
parents:
diff changeset
   208
     * application can safely check for a non-null URI by testing to see if the
7f561c08de6b Initial load
duke
parents:
diff changeset
   209
     * first character of the name is a '{' character.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   210
     * <p>For example, if a URI and local name were obtained from an element
7f561c08de6b Initial load
duke
parents:
diff changeset
   211
     * defined with &lt;xyz:foo
7f561c08de6b Initial load
duke
parents:
diff changeset
   212
     * xmlns:xyz="http://xyz.foo.com/yada/baz.html"/&gt;,
7f561c08de6b Initial load
duke
parents:
diff changeset
   213
     * then the qualified name would be "{http://xyz.foo.com/yada/baz.html}foo".
7f561c08de6b Initial load
duke
parents:
diff changeset
   214
     * Note that no prefix is used.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   215
     * An <code>IllegalArgumentException</code> is thrown  if any of the
7f561c08de6b Initial load
duke
parents:
diff changeset
   216
     * argument keys are not recognized and are not namespace qualified.
7f561c08de6b Initial load
duke
parents:
diff changeset
   217
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   218
     * @param oformat A set of output properties that will be
7f561c08de6b Initial load
duke
parents:
diff changeset
   219
     *   used to override any of the same properties in affect
7f561c08de6b Initial load
duke
parents:
diff changeset
   220
     *   for the transformation.
7f561c08de6b Initial load
duke
parents:
diff changeset
   221
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   222
     * @throws IllegalArgumentException When keys are not recognized and
7f561c08de6b Initial load
duke
parents:
diff changeset
   223
     *   are not namespace qualified.
7f561c08de6b Initial load
duke
parents:
diff changeset
   224
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   225
     * @see javax.xml.transform.OutputKeys
7f561c08de6b Initial load
duke
parents:
diff changeset
   226
     * @see java.util.Properties
7f561c08de6b Initial load
duke
parents:
diff changeset
   227
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   228
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   229
    public abstract void setOutputProperties(Properties oformat);
7f561c08de6b Initial load
duke
parents:
diff changeset
   230
7f561c08de6b Initial load
duke
parents:
diff changeset
   231
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   232
     * <p>Get a copy of the output properties for the transformation.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   233
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   234
     * <p>The properties returned should contain properties set by the user,
7f561c08de6b Initial load
duke
parents:
diff changeset
   235
     * and properties set by the stylesheet, and these properties
7f561c08de6b Initial load
duke
parents:
diff changeset
   236
     * are "defaulted" by default properties specified by
7f561c08de6b Initial load
duke
parents:
diff changeset
   237
     * <a href="http://www.w3.org/TR/xslt#output">section 16 of the
7f561c08de6b Initial load
duke
parents:
diff changeset
   238
     * XSL Transformations (XSLT) W3C Recommendation</a>.  The properties that
7f561c08de6b Initial load
duke
parents:
diff changeset
   239
     * were specifically set by the user or the stylesheet should be in the base
7f561c08de6b Initial load
duke
parents:
diff changeset
   240
     * Properties list, while the XSLT default properties that were not
7f561c08de6b Initial load
duke
parents:
diff changeset
   241
     * specifically set should be the default Properties list.  Thus,
7f561c08de6b Initial load
duke
parents:
diff changeset
   242
     * getOutputProperties().getProperty(String key) will obtain any
7f561c08de6b Initial load
duke
parents:
diff changeset
   243
     * property in that was set by {@link #setOutputProperty},
7f561c08de6b Initial load
duke
parents:
diff changeset
   244
     * {@link #setOutputProperties}, in the stylesheet, <em>or</em> the default
7f561c08de6b Initial load
duke
parents:
diff changeset
   245
     * properties, while
7f561c08de6b Initial load
duke
parents:
diff changeset
   246
     * getOutputProperties().get(String key) will only retrieve properties
7f561c08de6b Initial load
duke
parents:
diff changeset
   247
     * that were explicitly set by {@link #setOutputProperty},
7f561c08de6b Initial load
duke
parents:
diff changeset
   248
     * {@link #setOutputProperties}, or in the stylesheet.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   249
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   250
     * <p>Note that mutation of the Properties object returned will not
7f561c08de6b Initial load
duke
parents:
diff changeset
   251
     * effect the properties that the transformer contains.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   252
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   253
     * <p>If any of the argument keys are not recognized and are not
7f561c08de6b Initial load
duke
parents:
diff changeset
   254
     * namespace qualified, the property will be ignored and not returned.
7f561c08de6b Initial load
duke
parents:
diff changeset
   255
     * In other words the behaviour is not orthogonal with
7f561c08de6b Initial load
duke
parents:
diff changeset
   256
     * {@link #setOutputProperties setOutputProperties}.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   257
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   258
     * @return A copy of the set of output properties in effect for
7f561c08de6b Initial load
duke
parents:
diff changeset
   259
     *   the next transformation.
7f561c08de6b Initial load
duke
parents:
diff changeset
   260
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   261
     * @see javax.xml.transform.OutputKeys
7f561c08de6b Initial load
duke
parents:
diff changeset
   262
     * @see java.util.Properties
7f561c08de6b Initial load
duke
parents:
diff changeset
   263
     * @see <a href="http://www.w3.org/TR/xslt#output">
7f561c08de6b Initial load
duke
parents:
diff changeset
   264
     *   XSL Transformations (XSLT) Version 1.0</a>
7f561c08de6b Initial load
duke
parents:
diff changeset
   265
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   266
    public abstract Properties getOutputProperties();
7f561c08de6b Initial load
duke
parents:
diff changeset
   267
7f561c08de6b Initial load
duke
parents:
diff changeset
   268
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   269
     * Set an output property that will be in effect for the
7f561c08de6b Initial load
duke
parents:
diff changeset
   270
     * transformation.
7f561c08de6b Initial load
duke
parents:
diff changeset
   271
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   272
     * <p>Pass a qualified property name as a two-part string, the namespace URI
7f561c08de6b Initial load
duke
parents:
diff changeset
   273
     * enclosed in curly braces ({}), followed by the local name. If the
7f561c08de6b Initial load
duke
parents:
diff changeset
   274
     * name has a null URL, the String only contain the local name. An
7f561c08de6b Initial load
duke
parents:
diff changeset
   275
     * application can safely check for a non-null URI by testing to see if the
7f561c08de6b Initial load
duke
parents:
diff changeset
   276
     * first character of the name is a '{' character.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   277
     * <p>For example, if a URI and local name were obtained from an element
7f561c08de6b Initial load
duke
parents:
diff changeset
   278
     * defined with &lt;xyz:foo
7f561c08de6b Initial load
duke
parents:
diff changeset
   279
     * xmlns:xyz="http://xyz.foo.com/yada/baz.html"/&gt;,
7f561c08de6b Initial load
duke
parents:
diff changeset
   280
     * then the qualified name would be "{http://xyz.foo.com/yada/baz.html}foo".
7f561c08de6b Initial load
duke
parents:
diff changeset
   281
     * Note that no prefix is used.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   282
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   283
     * <p>The Properties object that was passed to {@link #setOutputProperties}
7f561c08de6b Initial load
duke
parents:
diff changeset
   284
     * won't be effected by calling this method.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   285
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   286
     * @param name A non-null String that specifies an output
7f561c08de6b Initial load
duke
parents:
diff changeset
   287
     * property name, which may be namespace qualified.
7f561c08de6b Initial load
duke
parents:
diff changeset
   288
     * @param value The non-null string value of the output property.
7f561c08de6b Initial load
duke
parents:
diff changeset
   289
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   290
     * @throws IllegalArgumentException If the property is not supported, and is
7f561c08de6b Initial load
duke
parents:
diff changeset
   291
     * not qualified with a namespace.
7f561c08de6b Initial load
duke
parents:
diff changeset
   292
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   293
     * @see javax.xml.transform.OutputKeys
7f561c08de6b Initial load
duke
parents:
diff changeset
   294
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   295
    public abstract void setOutputProperty(String name, String value)
7f561c08de6b Initial load
duke
parents:
diff changeset
   296
        throws IllegalArgumentException;
7f561c08de6b Initial load
duke
parents:
diff changeset
   297
7f561c08de6b Initial load
duke
parents:
diff changeset
   298
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   299
     * <p>Get an output property that is in effect for the transformer.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   300
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   301
     * <p>If a property has been set using {@link #setOutputProperty},
7f561c08de6b Initial load
duke
parents:
diff changeset
   302
     * that value will be returned. Otherwise, if a property is explicitly
7f561c08de6b Initial load
duke
parents:
diff changeset
   303
     * specified in the stylesheet, that value will be returned. If
7f561c08de6b Initial load
duke
parents:
diff changeset
   304
     * the value of the property has been defaulted, that is, if no
7f561c08de6b Initial load
duke
parents:
diff changeset
   305
     * value has been set explicitly either with {@link #setOutputProperty} or
7f561c08de6b Initial load
duke
parents:
diff changeset
   306
     * in the stylesheet, the result may vary depending on
7f561c08de6b Initial load
duke
parents:
diff changeset
   307
     * implementation and input stylesheet.</p>
7f561c08de6b Initial load
duke
parents:
diff changeset
   308
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   309
     * @param name A non-null String that specifies an output
7f561c08de6b Initial load
duke
parents:
diff changeset
   310
     * property name, which may be namespace qualified.
7f561c08de6b Initial load
duke
parents:
diff changeset
   311
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   312
     * @return The string value of the output property, or null
7f561c08de6b Initial load
duke
parents:
diff changeset
   313
     * if no property was found.
7f561c08de6b Initial load
duke
parents:
diff changeset
   314
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   315
     * @throws IllegalArgumentException If the property is not supported.
7f561c08de6b Initial load
duke
parents:
diff changeset
   316
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   317
     * @see javax.xml.transform.OutputKeys
7f561c08de6b Initial load
duke
parents:
diff changeset
   318
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   319
    public abstract String getOutputProperty(String name)
7f561c08de6b Initial load
duke
parents:
diff changeset
   320
        throws IllegalArgumentException;
7f561c08de6b Initial load
duke
parents:
diff changeset
   321
7f561c08de6b Initial load
duke
parents:
diff changeset
   322
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   323
     * Set the error event listener in effect for the transformation.
7f561c08de6b Initial load
duke
parents:
diff changeset
   324
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   325
     * @param listener The new error listener.
7f561c08de6b Initial load
duke
parents:
diff changeset
   326
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   327
     * @throws IllegalArgumentException if listener is null.
7f561c08de6b Initial load
duke
parents:
diff changeset
   328
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   329
    public abstract void setErrorListener(ErrorListener listener)
7f561c08de6b Initial load
duke
parents:
diff changeset
   330
        throws IllegalArgumentException;
7f561c08de6b Initial load
duke
parents:
diff changeset
   331
7f561c08de6b Initial load
duke
parents:
diff changeset
   332
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   333
     * Get the error event handler in effect for the transformation.
7f561c08de6b Initial load
duke
parents:
diff changeset
   334
     * Implementations must provide a default error listener.
7f561c08de6b Initial load
duke
parents:
diff changeset
   335
     *
7f561c08de6b Initial load
duke
parents:
diff changeset
   336
     * @return The current error handler, which should never be null.
7f561c08de6b Initial load
duke
parents:
diff changeset
   337
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   338
    public abstract ErrorListener getErrorListener();
7f561c08de6b Initial load
duke
parents:
diff changeset
   339
}