3
* The Apache Software License, Version 1.1
6
* Copyright (c) 2000-2002 The Apache Software Foundation. All rights
9
* Redistribution and use in source and binary forms, with or without
10
* modification, are permitted provided that the following conditions
13
* 1. Redistributions of source code must retain the above copyright
14
* notice, this list of conditions and the following disclaimer.
16
* 2. Redistributions in binary form must reproduce the above copyright
17
* notice, this list of conditions and the following disclaimer in
18
* the documentation and/or other materials provided with the
21
* 3. The end-user documentation included with the redistribution,
22
* if any, must include the following acknowledgment:
23
* "This product includes software developed by the
24
* Apache Software Foundation (http://www.apache.org/)."
25
* Alternately, this acknowledgment may appear in the software itself,
26
* if and wherever such third-party acknowledgments normally appear.
28
* 4. The names "Xerces" and "Apache Software Foundation" must
29
* not be used to endorse or promote products derived from this
30
* software without prior written permission. For written
31
* permission, please contact apache@apache.org.
33
* 5. Products derived from this software may not be called "Apache",
34
* nor may "Apache" appear in their name, without prior written
35
* permission of the Apache Software Foundation.
37
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
38
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
39
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
40
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
41
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
42
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
43
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
44
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
45
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
46
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
47
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
49
* ====================================================================
51
* This software consists of voluntary contributions made by many
52
* individuals on behalf of the Apache Software Foundation and was
53
* originally based on software copyright (c) 1999, Sun Microsystems, Inc.,
54
* http://www.sun.com. For more information on the Apache Software
55
* Foundation, please see <http://www.apache.org/>.
2
* Copyright 2000-2002,2004-2006 The Apache Software Foundation.
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
8
* http://www.apache.org/licenses/LICENSE-2.0
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
59
17
package org.apache.xerces.jaxp;
61
19
import java.util.Hashtable;
21
import javax.xml.XMLConstants;
63
22
import javax.xml.parsers.ParserConfigurationException;
64
23
import javax.xml.parsers.SAXParser;
65
24
import javax.xml.parsers.SAXParserFactory;
25
import javax.xml.validation.Schema;
27
import org.apache.xerces.impl.Constants;
67
28
import org.xml.sax.SAXException;
68
29
import org.xml.sax.SAXNotRecognizedException;
69
30
import org.xml.sax.SAXNotSupportedException;
72
* @author Rajiv Mordani
74
* @version $Id: SAXParserFactoryImpl.java,v 1.9 2003/05/08 20:11:58 elena Exp $
78
33
* This is the implementation specific class for the
79
34
* <code>javax.xml.parsers.SAXParserFactory</code>. This is the platform
80
35
* default implementation for the platform.
37
* @author Rajiv Mordani
40
* @version $Id: SAXParserFactoryImpl.java 439017 2006-08-31 19:18:44Z mrglavas $
82
42
public class SAXParserFactoryImpl extends SAXParserFactory {
44
/** Feature identifier: namespaces. */
45
private static final String NAMESPACES_FEATURE =
46
Constants.SAX_FEATURE_PREFIX + Constants.NAMESPACES_FEATURE;
48
/** Feature identifier: validation. */
49
private static final String VALIDATION_FEATURE =
50
Constants.SAX_FEATURE_PREFIX + Constants.VALIDATION_FEATURE;
52
/** Feature identifier: XInclude processing */
53
private static final String XINCLUDE_FEATURE =
54
Constants.XERCES_FEATURE_PREFIX + Constants.XINCLUDE_FEATURE;
83
56
private Hashtable features;
57
private Schema grammar;
58
private boolean isXIncludeAware;
61
* State of the secure processing feature, initially <code>false</code>
63
private boolean fSecureProcess = false;
86
66
* Creates a new instance of <code>SAXParser</code> using the currently
154
158
public boolean getFeature(String name)
155
159
throws ParserConfigurationException, SAXNotRecognizedException,
156
SAXNotSupportedException
160
SAXNotSupportedException {
162
throw new NullPointerException();
164
if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
165
return fSecureProcess;
167
else if (name.equals(NAMESPACES_FEATURE)) {
168
return isNamespaceAware();
170
else if (name.equals(VALIDATION_FEATURE)) {
171
return isValidating();
173
else if (name.equals(XINCLUDE_FEATURE)) {
174
return isXIncludeAware();
158
176
// Check for valid name by creating a dummy XMLReader to get
160
178
return newSAXParserImpl().getXMLReader().getFeature(name);
181
public Schema getSchema() {
185
public void setSchema(Schema grammar) {
186
this.grammar = grammar;
189
public boolean isXIncludeAware() {
190
return this.isXIncludeAware;
193
public void setXIncludeAware(boolean state) {
194
this.isXIncludeAware = state;