jaxp/src/javax/xml/transform/sax/SAXTransformerFactory.java
author henryjen
Thu, 19 Jun 2014 15:35:10 -0700
changeset 25262 1fe892ba017a
parent 12457 c348e06f0e82
permissions -rw-r--r--
8047723: @since tag cleanup in jaxp Reviewed-by: joehw
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
     1
/*
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
     2
 * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
     4
 *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    10
 *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    15
 * accompanied this code).
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    16
 *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    20
 *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    23
 * questions.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    24
 */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    25
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    26
package javax.xml.transform.sax;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    27
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    28
import javax.xml.transform.*;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    29
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    30
import org.xml.sax.XMLFilter;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    31
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    32
/**
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    33
 * This class extends TransformerFactory to provide SAX-specific
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    34
 * factory methods.  It provides two types of ContentHandlers,
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    35
 * one for creating Transformers, the other for creating Templates
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    36
 * objects.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    37
 *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    38
 * <p>If an application wants to set the ErrorHandler or EntityResolver
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    39
 * for an XMLReader used during a transformation, it should use a URIResolver
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    40
 * to return the SAXSource which provides (with getXMLReader) a reference to
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    41
 * the XMLReader.</p>
25262
1fe892ba017a 8047723: @since tag cleanup in jaxp
henryjen
parents: 12457
diff changeset
    42
 *
1fe892ba017a 8047723: @since tag cleanup in jaxp
henryjen
parents: 12457
diff changeset
    43
 * @since 1.4
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    44
 */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    45
public abstract class SAXTransformerFactory extends TransformerFactory {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    46
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    47
    /** If {@link javax.xml.transform.TransformerFactory#getFeature}
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    48
     * returns true when passed this value as an argument,
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    49
     * the TransformerFactory returned from
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    50
     * {@link javax.xml.transform.TransformerFactory#newInstance} may
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    51
     * be safely cast to a SAXTransformerFactory.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    52
     */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    53
    public static final String FEATURE =
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    54
        "http://javax.xml.transform.sax.SAXTransformerFactory/feature";
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    55
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    56
    /** If {@link javax.xml.transform.TransformerFactory#getFeature}
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    57
     * returns true when passed this value as an argument,
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    58
     * the {@link #newXMLFilter(Source src)}
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    59
     * and {@link #newXMLFilter(Templates templates)} methods are supported.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    60
     */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    61
    public static final String FEATURE_XMLFILTER =
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    62
        "http://javax.xml.transform.sax.SAXTransformerFactory/feature/xmlfilter";
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    63
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    64
    /**
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    65
     * The default constructor is protected on purpose.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    66
     */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    67
    protected SAXTransformerFactory() {}
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    68
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    69
    /**
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    70
     * Get a TransformerHandler object that can process SAX
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    71
     * ContentHandler events into a Result, based on the transformation
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    72
     * instructions specified by the argument.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    73
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    74
     * @param src The Source of the transformation instructions.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    75
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    76
     * @return TransformerHandler ready to transform SAX events.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    77
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    78
     * @throws TransformerConfigurationException If for some reason the
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    79
     * TransformerHandler can not be created.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    80
     */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    81
    public abstract TransformerHandler newTransformerHandler(Source src)
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    82
        throws TransformerConfigurationException;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    83
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    84
    /**
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    85
     * Get a TransformerHandler object that can process SAX
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    86
     * ContentHandler events into a Result, based on the Templates argument.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    87
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    88
     * @param templates The compiled transformation instructions.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    89
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    90
     * @return TransformerHandler ready to transform SAX events.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    91
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    92
     * @throws TransformerConfigurationException If for some reason the
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    93
     * TransformerHandler can not be created.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    94
     */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    95
    public abstract TransformerHandler newTransformerHandler(
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    96
        Templates templates) throws TransformerConfigurationException;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    97
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    98
    /**
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    99
     * Get a TransformerHandler object that can process SAX
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   100
     * ContentHandler events into a Result. The transformation
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   101
     * is defined as an identity (or copy) transformation, for example
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   102
     * to copy a series of SAX parse events into a DOM tree.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   103
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   104
     * @return A non-null reference to a TransformerHandler, that may
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   105
     * be used as a ContentHandler for SAX parse events.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   106
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   107
     * @throws TransformerConfigurationException If for some reason the
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   108
     * TransformerHandler cannot be created.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   109
     */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   110
    public abstract TransformerHandler newTransformerHandler()
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   111
        throws TransformerConfigurationException;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   112
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   113
    /**
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   114
     * Get a TemplatesHandler object that can process SAX
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   115
     * ContentHandler events into a Templates object.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   116
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   117
     * @return A non-null reference to a TransformerHandler, that may
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   118
     * be used as a ContentHandler for SAX parse events.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   119
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   120
     * @throws TransformerConfigurationException If for some reason the
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   121
     * TemplatesHandler cannot be created.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   122
     */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   123
    public abstract TemplatesHandler newTemplatesHandler()
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   124
        throws TransformerConfigurationException;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   125
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   126
    /**
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   127
     * Create an XMLFilter that uses the given Source as the
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   128
     * transformation instructions.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   129
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   130
     * @param src The Source of the transformation instructions.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   131
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   132
     * @return An XMLFilter object, or null if this feature is not supported.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   133
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   134
     * @throws TransformerConfigurationException If for some reason the
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   135
     * TemplatesHandler cannot be created.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   136
     */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   137
    public abstract XMLFilter newXMLFilter(Source src)
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   138
        throws TransformerConfigurationException;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   139
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   140
    /**
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   141
     * Create an XMLFilter, based on the Templates argument..
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   142
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   143
     * @param templates The compiled transformation instructions.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   144
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   145
     * @return An XMLFilter object, or null if this feature is not supported.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   146
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   147
     * @throws TransformerConfigurationException If for some reason the
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   148
     * TemplatesHandler cannot be created.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   149
     */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   150
    public abstract XMLFilter newXMLFilter(Templates templates)
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   151
        throws TransformerConfigurationException;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   152
}