src/java.xml/share/classes/javax/xml/parsers/SAXParserFactory.java
author thartmann
Fri, 24 Aug 2018 08:17:23 +0200
changeset 51514 1e332d63bd96
parent 48412 d4412e380f6b
child 54342 07212a29787a
permissions -rw-r--r--
8209833: C2 compilation fails with "assert(ex_map->jvms()->same_calls_as(_exceptions->jvms())) failed: all collected exceptions must come from the same place" Summary: Deoptimize if exception is thrown in _clone intrinsic. Reviewed-by: kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
     1
/*
29419
534054ee6062 8049378: Examine references to ${java.home}/lib in JAXP
joehw
parents: 27574
diff changeset
     2
 * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
12005
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.parsers;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    27
42390
4083bc2c3b5b 8169778: Add new public methods to get new instances of the JAXP factories builtin system-default implementations
dfuchs
parents: 29999
diff changeset
    28
import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl;
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    29
import javax.xml.validation.Schema;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    30
import org.xml.sax.SAXException;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    31
import org.xml.sax.SAXNotRecognizedException;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    32
import org.xml.sax.SAXNotSupportedException;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    33
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    34
/**
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    35
 * Defines a factory API that enables applications to configure and
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    36
 * obtain a SAX based parser to parse XML documents.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    37
 *
48412
d4412e380f6b 8184431: References to @sun.com
joehw
parents: 47216
diff changeset
    38
 * @author Jeff Suttor
d4412e380f6b 8184431: References to @sun.com
joehw
parents: 47216
diff changeset
    39
 * @author Neeraj Bajaj
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    40
 *
25262
1fe892ba017a 8047723: @since tag cleanup in jaxp
henryjen
parents: 24887
diff changeset
    41
 * @since 1.4
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    42
 */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    43
public abstract class SAXParserFactory {
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
    /**
29999
8493f5fc1052 8077332: tidy warnings from javax/xml
avstepan
parents: 29419
diff changeset
    46
     * Should Parsers be validating?
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    47
     */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    48
    private boolean validating = false;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    49
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    50
    /**
29999
8493f5fc1052 8077332: tidy warnings from javax/xml
avstepan
parents: 29419
diff changeset
    51
     * Should Parsers be namespace aware?
12005
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
    private boolean namespaceAware = false;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    54
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    55
    /**
29999
8493f5fc1052 8077332: tidy warnings from javax/xml
avstepan
parents: 29419
diff changeset
    56
     * Protected constructor to force use of {@link #newInstance()}.
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    57
     */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    58
    protected SAXParserFactory () {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    59
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
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    62
    /**
42390
4083bc2c3b5b 8169778: Add new public methods to get new instances of the JAXP factories builtin system-default implementations
dfuchs
parents: 29999
diff changeset
    63
     * Creates a new instance of the {@code SAXParserFactory} builtin
4083bc2c3b5b 8169778: Add new public methods to get new instances of the JAXP factories builtin system-default implementations
dfuchs
parents: 29999
diff changeset
    64
     * system-default implementation.
4083bc2c3b5b 8169778: Add new public methods to get new instances of the JAXP factories builtin system-default implementations
dfuchs
parents: 29999
diff changeset
    65
     *
4083bc2c3b5b 8169778: Add new public methods to get new instances of the JAXP factories builtin system-default implementations
dfuchs
parents: 29999
diff changeset
    66
     * @return A new instance of the {@code SAXParserFactory} builtin
4083bc2c3b5b 8169778: Add new public methods to get new instances of the JAXP factories builtin system-default implementations
dfuchs
parents: 29999
diff changeset
    67
     *         system-default implementation.
4083bc2c3b5b 8169778: Add new public methods to get new instances of the JAXP factories builtin system-default implementations
dfuchs
parents: 29999
diff changeset
    68
     *
4083bc2c3b5b 8169778: Add new public methods to get new instances of the JAXP factories builtin system-default implementations
dfuchs
parents: 29999
diff changeset
    69
     * @since 9
4083bc2c3b5b 8169778: Add new public methods to get new instances of the JAXP factories builtin system-default implementations
dfuchs
parents: 29999
diff changeset
    70
     */
4083bc2c3b5b 8169778: Add new public methods to get new instances of the JAXP factories builtin system-default implementations
dfuchs
parents: 29999
diff changeset
    71
    public static SAXParserFactory newDefaultInstance() {
4083bc2c3b5b 8169778: Add new public methods to get new instances of the JAXP factories builtin system-default implementations
dfuchs
parents: 29999
diff changeset
    72
        return new SAXParserFactoryImpl();
4083bc2c3b5b 8169778: Add new public methods to get new instances of the JAXP factories builtin system-default implementations
dfuchs
parents: 29999
diff changeset
    73
    }
4083bc2c3b5b 8169778: Add new public methods to get new instances of the JAXP factories builtin system-default implementations
dfuchs
parents: 29999
diff changeset
    74
4083bc2c3b5b 8169778: Add new public methods to get new instances of the JAXP factories builtin system-default implementations
dfuchs
parents: 29999
diff changeset
    75
    /**
29419
534054ee6062 8049378: Examine references to ${java.home}/lib in JAXP
joehw
parents: 27574
diff changeset
    76
     * Obtain a new instance of a {@code SAXParserFactory}. This
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    77
     * static method creates a new factory instance
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    78
     * This method uses the following ordered lookup procedure to determine
29419
534054ee6062 8049378: Examine references to ${java.home}/lib in JAXP
joehw
parents: 27574
diff changeset
    79
     * the {@code SAXParserFactory} implementation class to
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    80
     * load:
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    81
     * <ul>
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    82
     * <li>
29419
534054ee6062 8049378: Examine references to ${java.home}/lib in JAXP
joehw
parents: 27574
diff changeset
    83
     * Use the {@code javax.xml.parsers.SAXParserFactory} system
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    84
     * property.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    85
     * </li>
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    86
     * <li>
29419
534054ee6062 8049378: Examine references to ${java.home}/lib in JAXP
joehw
parents: 27574
diff changeset
    87
     * <p>
534054ee6062 8049378: Examine references to ${java.home}/lib in JAXP
joehw
parents: 27574
diff changeset
    88
     * Use the configuration file "jaxp.properties". The file is in standard
534054ee6062 8049378: Examine references to ${java.home}/lib in JAXP
joehw
parents: 27574
diff changeset
    89
     * {@link java.util.Properties} format and typically located in the
534054ee6062 8049378: Examine references to ${java.home}/lib in JAXP
joehw
parents: 27574
diff changeset
    90
     * {@code conf} directory of the Java installation. It contains the fully qualified
534054ee6062 8049378: Examine references to ${java.home}/lib in JAXP
joehw
parents: 27574
diff changeset
    91
     * name of the implementation class with the key being the system property
534054ee6062 8049378: Examine references to ${java.home}/lib in JAXP
joehw
parents: 27574
diff changeset
    92
     * defined above.
534054ee6062 8049378: Examine references to ${java.home}/lib in JAXP
joehw
parents: 27574
diff changeset
    93
     * <p>
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    94
     * The jaxp.properties file is read only once by the JAXP implementation
29419
534054ee6062 8049378: Examine references to ${java.home}/lib in JAXP
joehw
parents: 27574
diff changeset
    95
     * and its values are then cached for future use.  If the file does not exist
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    96
     * when the first attempt is made to read from it, no further attempts are
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    97
     * made to check for its existence.  It is not possible to change the value
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    98
     * of any property in jaxp.properties after it has been read for the first time.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
    99
     * </li>
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   100
     * <li>
29419
534054ee6062 8049378: Examine references to ${java.home}/lib in JAXP
joehw
parents: 27574
diff changeset
   101
     * <p>
534054ee6062 8049378: Examine references to ${java.home}/lib in JAXP
joehw
parents: 27574
diff changeset
   102
     * Use the service-provider loading facility, defined by the
17264
3aff554ad461 8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents: 12457
diff changeset
   103
     * {@link java.util.ServiceLoader} class, to attempt to locate and load an
20581
65d17ea72da3 8025745: Clarify API documentation of JAXP factories.
dfuchs
parents: 17264
diff changeset
   104
     * implementation of the service using the {@linkplain
65d17ea72da3 8025745: Clarify API documentation of JAXP factories.
dfuchs
parents: 17264
diff changeset
   105
     * java.util.ServiceLoader#load(java.lang.Class) default loading mechanism}:
65d17ea72da3 8025745: Clarify API documentation of JAXP factories.
dfuchs
parents: 17264
diff changeset
   106
     * the service-provider loading facility will use the {@linkplain
65d17ea72da3 8025745: Clarify API documentation of JAXP factories.
dfuchs
parents: 17264
diff changeset
   107
     * java.lang.Thread#getContextClassLoader() current thread's context class loader}
65d17ea72da3 8025745: Clarify API documentation of JAXP factories.
dfuchs
parents: 17264
diff changeset
   108
     * to attempt to load the service. If the context class
65d17ea72da3 8025745: Clarify API documentation of JAXP factories.
dfuchs
parents: 17264
diff changeset
   109
     * loader is null, the {@linkplain
65d17ea72da3 8025745: Clarify API documentation of JAXP factories.
dfuchs
parents: 17264
diff changeset
   110
     * ClassLoader#getSystemClassLoader() system class loader} will be used.
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   111
     * </li>
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   112
     * <li>
29419
534054ee6062 8049378: Examine references to ${java.home}/lib in JAXP
joehw
parents: 27574
diff changeset
   113
     * <p>
42390
4083bc2c3b5b 8169778: Add new public methods to get new instances of the JAXP factories builtin system-default implementations
dfuchs
parents: 29999
diff changeset
   114
     * Otherwise, the {@linkplain #newDefaultInstance() system-default}
4083bc2c3b5b 8169778: Add new public methods to get new instances of the JAXP factories builtin system-default implementations
dfuchs
parents: 29999
diff changeset
   115
     * implementation is returned.
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   116
     * </li>
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   117
     * </ul>
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   118
     *
29419
534054ee6062 8049378: Examine references to ${java.home}/lib in JAXP
joehw
parents: 27574
diff changeset
   119
     * <p>
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   120
     * Once an application has obtained a reference to a
29419
534054ee6062 8049378: Examine references to ${java.home}/lib in JAXP
joehw
parents: 27574
diff changeset
   121
     * {@code SAXParserFactory} it can use the factory to
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   122
     * configure and obtain parser instances.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   123
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   124
     *
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
     * <h2>Tip for Trouble-shooting</h2>
29419
534054ee6062 8049378: Examine references to ${java.home}/lib in JAXP
joehw
parents: 27574
diff changeset
   127
     * <p>
534054ee6062 8049378: Examine references to ${java.home}/lib in JAXP
joehw
parents: 27574
diff changeset
   128
     * Setting the {@code jaxp.debug} system property will cause
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   129
     * this method to print a lot of debug messages
29419
534054ee6062 8049378: Examine references to ${java.home}/lib in JAXP
joehw
parents: 27574
diff changeset
   130
     * to {@code System.err} about what it is doing and where it is looking at.
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   131
     *
29419
534054ee6062 8049378: Examine references to ${java.home}/lib in JAXP
joehw
parents: 27574
diff changeset
   132
     * <p>
534054ee6062 8049378: Examine references to ${java.home}/lib in JAXP
joehw
parents: 27574
diff changeset
   133
     * If you have problems loading {@link SAXParser}s, try:
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   134
     * <pre>
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   135
     * java -Djaxp.debug=1 YourProgram ....
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   136
     * </pre>
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   137
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   138
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   139
     * @return A new instance of a SAXParserFactory.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   140
     *
17264
3aff554ad461 8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents: 12457
diff changeset
   141
     * @throws FactoryConfigurationError in case of {@linkplain
3aff554ad461 8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents: 12457
diff changeset
   142
     * java.util.ServiceConfigurationError service configuration error} or if
3aff554ad461 8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents: 12457
diff changeset
   143
     * the implementation is not available or cannot be instantiated.
12005
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
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   146
    public static SAXParserFactory newInstance() {
17264
3aff554ad461 8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents: 12457
diff changeset
   147
        return FactoryFinder.find(
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   148
                /* The default property name according to the JAXP spec */
17264
3aff554ad461 8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents: 12457
diff changeset
   149
                SAXParserFactory.class,
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   150
                /* The fallback implementation class name */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   151
                "com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl");
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   152
    }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   153
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   154
    /**
29999
8493f5fc1052 8077332: tidy warnings from javax/xml
avstepan
parents: 29419
diff changeset
   155
     * Obtain a new instance of a {@code SAXParserFactory} from class name.
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   156
     * This function is useful when there are multiple providers in the classpath.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   157
     * It gives more control to the application as it can specify which provider
29999
8493f5fc1052 8077332: tidy warnings from javax/xml
avstepan
parents: 29419
diff changeset
   158
     * should be loaded.
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   159
     *
29419
534054ee6062 8049378: Examine references to ${java.home}/lib in JAXP
joehw
parents: 27574
diff changeset
   160
     * <p>Once an application has obtained a reference to a {@code SAXParserFactory}
29999
8493f5fc1052 8077332: tidy warnings from javax/xml
avstepan
parents: 29419
diff changeset
   161
     * it can use the factory to configure and obtain parser instances.
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   162
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   163
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   164
     * <h2>Tip for Trouble-shooting</h2>
29419
534054ee6062 8049378: Examine references to ${java.home}/lib in JAXP
joehw
parents: 27574
diff changeset
   165
     * <p>Setting the {@code jaxp.debug} system property will cause
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   166
     * this method to print a lot of debug messages
29999
8493f5fc1052 8077332: tidy warnings from javax/xml
avstepan
parents: 29419
diff changeset
   167
     * to {@code System.err} about what it is doing and where it is looking at.
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   168
     *
29419
534054ee6062 8049378: Examine references to ${java.home}/lib in JAXP
joehw
parents: 27574
diff changeset
   169
     * <p>
534054ee6062 8049378: Examine references to ${java.home}/lib in JAXP
joehw
parents: 27574
diff changeset
   170
     * If you have problems, try:
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   171
     * <pre>
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   172
     * java -Djaxp.debug=1 YourProgram ....
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   173
     * </pre>
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   174
     *
29419
534054ee6062 8049378: Examine references to ${java.home}/lib in JAXP
joehw
parents: 27574
diff changeset
   175
     * @param factoryClassName fully qualified factory class name that provides implementation of {@code javax.xml.parsers.SAXParserFactory}.
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   176
     *
29999
8493f5fc1052 8077332: tidy warnings from javax/xml
avstepan
parents: 29419
diff changeset
   177
     * @param classLoader {@code ClassLoader} used to load the factory class. If {@code null}
8493f5fc1052 8077332: tidy warnings from javax/xml
avstepan
parents: 29419
diff changeset
   178
     *                     current {@code Thread}'s context classLoader is used to load the factory class.
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   179
     *
29419
534054ee6062 8049378: Examine references to ${java.home}/lib in JAXP
joehw
parents: 27574
diff changeset
   180
     * @return New instance of a {@code SAXParserFactory}
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   181
     *
29999
8493f5fc1052 8077332: tidy warnings from javax/xml
avstepan
parents: 29419
diff changeset
   182
     * @throws FactoryConfigurationError if {@code factoryClassName} is {@code null}, or
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   183
     *                                   the factory class cannot be loaded, instantiated.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   184
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   185
     * @see #newInstance()
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   186
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   187
     * @since 1.6
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   188
     */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   189
    public static SAXParserFactory newInstance(String factoryClassName, ClassLoader classLoader){
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   190
            //do not fallback if given classloader can't find the class, throw exception
17264
3aff554ad461 8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents: 12457
diff changeset
   191
            return FactoryFinder.newInstance(SAXParserFactory.class,
3aff554ad461 8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents: 12457
diff changeset
   192
                    factoryClassName, classLoader, false);
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   193
    }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   194
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   195
    /**
29999
8493f5fc1052 8077332: tidy warnings from javax/xml
avstepan
parents: 29419
diff changeset
   196
     * Creates a new instance of a SAXParser using the currently
8493f5fc1052 8077332: tidy warnings from javax/xml
avstepan
parents: 29419
diff changeset
   197
     * configured factory parameters.
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   198
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   199
     * @return A new instance of a SAXParser.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   200
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   201
     * @throws ParserConfigurationException if a parser cannot
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   202
     *   be created which satisfies the requested configuration.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   203
     * @throws SAXException for SAX errors.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   204
     */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   205
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   206
    public abstract SAXParser newSAXParser()
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   207
        throws ParserConfigurationException, SAXException;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   208
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   209
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   210
    /**
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   211
     * Specifies that the parser produced by this code will
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   212
     * provide support for XML namespaces. By default the value of this is set
29999
8493f5fc1052 8077332: tidy warnings from javax/xml
avstepan
parents: 29419
diff changeset
   213
     * to {@code false}.
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   214
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   215
     * @param awareness true if the parser produced by this code will
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   216
     *                  provide support for XML namespaces; false otherwise.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   217
     */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   218
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   219
    public void setNamespaceAware(boolean awareness) {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   220
        this.namespaceAware = awareness;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   221
    }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   222
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   223
    /**
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   224
     * Specifies that the parser produced by this code will
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   225
     * validate documents as they are parsed. By default the value of this is
29999
8493f5fc1052 8077332: tidy warnings from javax/xml
avstepan
parents: 29419
diff changeset
   226
     * set to {@code false}.
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   227
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   228
     * <p>
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   229
     * Note that "the validation" here means
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   230
     * <a href="http://www.w3.org/TR/REC-xml#proc-types">a validating
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   231
     * parser</a> as defined in the XML recommendation.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   232
     * In other words, it essentially just controls the DTD validation.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   233
     * (except the legacy two properties defined in JAXP 1.2.)
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   234
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   235
     * <p>
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   236
     * To use modern schema languages such as W3C XML Schema or
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   237
     * RELAX NG instead of DTD, you can configure your parser to be
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   238
     * a non-validating parser by leaving the {@link #setValidating(boolean)}
29999
8493f5fc1052 8077332: tidy warnings from javax/xml
avstepan
parents: 29419
diff changeset
   239
     * method {@code false}, then use the {@link #setSchema(Schema)}
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   240
     * method to associate a schema to a parser.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   241
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   242
     * @param validating true if the parser produced by this code will
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   243
     *                   validate documents as they are parsed; false otherwise.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   244
     */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   245
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   246
    public void setValidating(boolean validating) {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   247
        this.validating = validating;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   248
    }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   249
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   250
    /**
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   251
     * Indicates whether or not the factory is configured to produce
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   252
     * parsers which are namespace aware.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   253
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   254
     * @return true if the factory is configured to produce
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   255
     *         parsers which are namespace aware; false otherwise.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   256
     */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   257
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   258
    public boolean isNamespaceAware() {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   259
        return namespaceAware;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   260
    }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   261
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   262
    /**
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   263
     * Indicates whether or not the factory is configured to produce
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   264
     * parsers which validate the XML content during parse.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   265
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   266
     * @return true if the factory is configured to produce parsers which validate
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   267
     *         the XML content during parse; false otherwise.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   268
     */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   269
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   270
    public boolean isValidating() {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   271
        return validating;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   272
    }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   273
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   274
    /**
29999
8493f5fc1052 8077332: tidy warnings from javax/xml
avstepan
parents: 29419
diff changeset
   275
     * Sets the particular feature in the underlying implementation of
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   276
     * org.xml.sax.XMLReader.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   277
     * A list of the core features and properties can be found at
29999
8493f5fc1052 8077332: tidy warnings from javax/xml
avstepan
parents: 29419
diff changeset
   278
     * <a href="http://www.saxproject.org/">http://www.saxproject.org/</a>
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   279
     *
17264
3aff554ad461 8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents: 12457
diff changeset
   280
     * <p>All implementations are required to support the {@link javax.xml.XMLConstants#FEATURE_SECURE_PROCESSING} feature.
29999
8493f5fc1052 8077332: tidy warnings from javax/xml
avstepan
parents: 29419
diff changeset
   281
     * When the feature is
17264
3aff554ad461 8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents: 12457
diff changeset
   282
     * <ul>
3aff554ad461 8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents: 12457
diff changeset
   283
     *   <li>
29999
8493f5fc1052 8077332: tidy warnings from javax/xml
avstepan
parents: 29419
diff changeset
   284
     *     {@code true}: the implementation will limit XML processing to conform to implementation limits.
17264
3aff554ad461 8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents: 12457
diff changeset
   285
     *     Examples include entity expansion limits and XML Schema constructs that would consume large amounts of resources.
3aff554ad461 8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents: 12457
diff changeset
   286
     *     If XML processing is limited for security reasons, it will be reported via a call to the registered
3aff554ad461 8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents: 12457
diff changeset
   287
     *     {@link org.xml.sax.ErrorHandler#fatalError(SAXParseException exception)}.
29999
8493f5fc1052 8077332: tidy warnings from javax/xml
avstepan
parents: 29419
diff changeset
   288
     *     See {@link SAXParser} {@code parse} methods for handler specification.
17264
3aff554ad461 8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents: 12457
diff changeset
   289
     *   </li>
3aff554ad461 8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents: 12457
diff changeset
   290
     *   <li>
29999
8493f5fc1052 8077332: tidy warnings from javax/xml
avstepan
parents: 29419
diff changeset
   291
     *     When the feature is {@code false}, the implementation will processing XML according to the XML specifications without
17264
3aff554ad461 8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents: 12457
diff changeset
   292
     *     regard to possible implementation limits.
3aff554ad461 8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents: 12457
diff changeset
   293
     *   </li>
3aff554ad461 8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents: 12457
diff changeset
   294
     * </ul>
3aff554ad461 8005954: JAXP Plugability Layer should use java.util.ServiceLoader
dfuchs
parents: 12457
diff changeset
   295
     *
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   296
     * @param name The name of the feature to be set.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   297
     * @param value The value of the feature to be set.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   298
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   299
     * @throws ParserConfigurationException if a parser cannot
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   300
     *     be created which satisfies the requested configuration.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   301
     * @throws SAXNotRecognizedException When the underlying XMLReader does
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   302
     *            not recognize the property name.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   303
     * @throws SAXNotSupportedException When the underlying XMLReader
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   304
     *            recognizes the property name but doesn't support the
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   305
     *            property.
29999
8493f5fc1052 8077332: tidy warnings from javax/xml
avstepan
parents: 29419
diff changeset
   306
     * @throws NullPointerException If the {@code name} parameter is null.
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   307
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   308
     * @see org.xml.sax.XMLReader#setFeature
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   309
     */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   310
    public abstract void setFeature(String name, boolean value)
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   311
        throws ParserConfigurationException, SAXNotRecognizedException,
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   312
                SAXNotSupportedException;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   313
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   314
    /**
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   315
     *
29999
8493f5fc1052 8077332: tidy warnings from javax/xml
avstepan
parents: 29419
diff changeset
   316
     * Returns the particular property requested for in the underlying
8493f5fc1052 8077332: tidy warnings from javax/xml
avstepan
parents: 29419
diff changeset
   317
     * implementation of org.xml.sax.XMLReader.
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   318
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   319
     * @param name The name of the property to be retrieved.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   320
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   321
     * @return Value of the requested property.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   322
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   323
     * @throws ParserConfigurationException if a parser cannot be created which satisfies the requested configuration.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   324
     * @throws SAXNotRecognizedException When the underlying XMLReader does not recognize the property name.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   325
     * @throws SAXNotSupportedException When the underlying XMLReader recognizes the property name but doesn't support the property.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   326
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   327
     * @see org.xml.sax.XMLReader#getProperty
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   328
     */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   329
    public abstract boolean getFeature(String name)
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   330
        throws ParserConfigurationException, SAXNotRecognizedException,
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   331
                SAXNotSupportedException;
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   332
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   333
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   334
    /**
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   335
     * Gets the {@link Schema} object specified through
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   336
     * the {@link #setSchema(Schema schema)} method.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   337
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   338
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   339
     * @throws UnsupportedOperationException When implementation does not
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   340
     *   override this method
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   341
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   342
     * @return
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   343
     *      the {@link Schema} object that was last set through
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   344
     *      the {@link #setSchema(Schema)} method, or null
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   345
     *      if the method was not invoked since a {@link SAXParserFactory}
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   346
     *      is created.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   347
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   348
     * @since 1.5
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   349
     */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   350
    public Schema getSchema() {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   351
        throw new UnsupportedOperationException(
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   352
            "This parser does not support specification \""
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   353
            + this.getClass().getPackage().getSpecificationTitle()
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   354
            + "\" version \""
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   355
            + this.getClass().getPackage().getSpecificationVersion()
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   356
            + "\""
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   357
            );
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   358
    }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   359
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   360
    /**
29999
8493f5fc1052 8077332: tidy warnings from javax/xml
avstepan
parents: 29419
diff changeset
   361
     * Set the {@link Schema} to be used by parsers created
8493f5fc1052 8077332: tidy warnings from javax/xml
avstepan
parents: 29419
diff changeset
   362
     * from this factory.
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   363
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   364
     * <p>When a {@link Schema} is non-null, a parser will use a validator
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   365
     * created from it to validate documents before it passes information
29999
8493f5fc1052 8077332: tidy warnings from javax/xml
avstepan
parents: 29419
diff changeset
   366
     * down to the application.
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   367
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   368
     * <p>When warnings/errors/fatal errors are found by the validator, the parser must
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   369
     * handle them as if those errors were found by the parser itself.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   370
     * In other words, if the user-specified {@link org.xml.sax.ErrorHandler}
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   371
     * is set, it must receive those errors, and if not, they must be
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   372
     * treated according to the implementation specific
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   373
     * default error handling rules.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   374
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   375
     * <p>A validator may modify the SAX event stream (for example by
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   376
     * adding default values that were missing in documents), and a parser
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   377
     * is responsible to make sure that the application will receive
29999
8493f5fc1052 8077332: tidy warnings from javax/xml
avstepan
parents: 29419
diff changeset
   378
     * those modified event stream.
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   379
     *
29999
8493f5fc1052 8077332: tidy warnings from javax/xml
avstepan
parents: 29419
diff changeset
   380
     * <p>Initially, {@code null} is set as the {@link Schema}.
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   381
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   382
     * <p>This processing will take effect even if
29999
8493f5fc1052 8077332: tidy warnings from javax/xml
avstepan
parents: 29419
diff changeset
   383
     * the {@link #isValidating()} method returns {@code false}.
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   384
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   385
     * <p>It is an error to use
29999
8493f5fc1052 8077332: tidy warnings from javax/xml
avstepan
parents: 29419
diff changeset
   386
     * the {@code http://java.sun.com/xml/jaxp/properties/schemaSource}
8493f5fc1052 8077332: tidy warnings from javax/xml
avstepan
parents: 29419
diff changeset
   387
     * property and/or the {@code http://java.sun.com/xml/jaxp/properties/schemaLanguage}
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   388
     * property in conjunction with a non-null {@link Schema} object.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   389
     * Such configuration will cause a {@link SAXException}
29999
8493f5fc1052 8077332: tidy warnings from javax/xml
avstepan
parents: 29419
diff changeset
   390
     * exception when those properties are set on a {@link SAXParser}.
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   391
     *
29999
8493f5fc1052 8077332: tidy warnings from javax/xml
avstepan
parents: 29419
diff changeset
   392
     * <h3>Note for implementors</h3>
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   393
     * <p>
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   394
     * A parser must be able to work with any {@link Schema}
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   395
     * implementation. However, parsers and schemas are allowed
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   396
     * to use implementation-specific custom mechanisms
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   397
     * as long as they yield the result described in the specification.
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   398
     *
29999
8493f5fc1052 8077332: tidy warnings from javax/xml
avstepan
parents: 29419
diff changeset
   399
     * @param schema {@code Schema} to use, {@code null} to remove a schema.
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   400
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   401
     * @throws UnsupportedOperationException When implementation does not
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   402
     *   override this method
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   403
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   404
     * @since 1.5
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   405
     */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   406
    public void setSchema(Schema schema) {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   407
        throw new UnsupportedOperationException(
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   408
            "This parser does not support specification \""
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   409
            + this.getClass().getPackage().getSpecificationTitle()
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   410
            + "\" version \""
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   411
            + this.getClass().getPackage().getSpecificationVersion()
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   412
            + "\""
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   413
            );
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   414
    }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   415
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   416
    /**
29999
8493f5fc1052 8077332: tidy warnings from javax/xml
avstepan
parents: 29419
diff changeset
   417
     * Set state of XInclude processing.
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   418
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   419
     * <p>If XInclude markup is found in the document instance, should it be
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   420
     * processed as specified in <a href="http://www.w3.org/TR/xinclude/">
29999
8493f5fc1052 8077332: tidy warnings from javax/xml
avstepan
parents: 29419
diff changeset
   421
     * XML Inclusions (XInclude) Version 1.0</a>.
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   422
     *
29999
8493f5fc1052 8077332: tidy warnings from javax/xml
avstepan
parents: 29419
diff changeset
   423
     * <p>XInclude processing defaults to {@code false}.
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   424
     *
29999
8493f5fc1052 8077332: tidy warnings from javax/xml
avstepan
parents: 29419
diff changeset
   425
     * @param state Set XInclude processing to {@code true} or
8493f5fc1052 8077332: tidy warnings from javax/xml
avstepan
parents: 29419
diff changeset
   426
     *   {@code false}
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   427
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   428
     * @throws UnsupportedOperationException When implementation does not
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   429
     *   override this method
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   430
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   431
     * @since 1.5
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   432
     */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   433
    public void setXIncludeAware(final boolean state) {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   434
        if (state) {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   435
            throw new UnsupportedOperationException(" setXIncludeAware " +
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   436
                "is not supported on this JAXP"  +
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   437
                " implementation or earlier: " + this.getClass());
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   438
        }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   439
    }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   440
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   441
    /**
29999
8493f5fc1052 8077332: tidy warnings from javax/xml
avstepan
parents: 29419
diff changeset
   442
     * Get state of XInclude processing.
12005
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   443
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   444
     * @return current state of XInclude processing
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   445
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   446
     * @throws UnsupportedOperationException When implementation does not
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   447
     *   override this method
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   448
     *
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   449
     * @since 1.5
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   450
     */
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   451
    public boolean isXIncludeAware() {
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   452
        throw new UnsupportedOperationException(
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   453
            "This parser does not support specification \""
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   454
            + this.getClass().getPackage().getSpecificationTitle()
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   455
            + "\" version \""
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   456
            + this.getClass().getPackage().getSpecificationVersion()
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   457
            + "\""
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   458
            );
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   459
    }
a754d69d5e60 7150324: Stop using drop bundles in jaxp
ohair
parents:
diff changeset
   460
}