1 /*
2 * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
3 */
4 /*
5 * Licensed to the Apache Software Foundation (ASF) under one or more
6 * contributor license agreements. See the NOTICE file distributed with
7 * this work for additional information regarding copyright ownership.
8 * The ASF licenses this file to You under the Apache License, Version 2.0
9 * (the "License"); you may not use this file except in compliance with
10 * the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20
21 package com.sun.org.apache.xerces.internal.jaxp;
22
23 import com.sun.org.apache.xerces.internal.impl.Constants;
24 import com.sun.org.apache.xerces.internal.util.SAXMessageFormatter;
25 import java.util.HashMap;
26 import java.util.Map;
27 import javax.xml.XMLConstants;
28 import javax.xml.parsers.ParserConfigurationException;
29 import javax.xml.parsers.SAXParser;
30 import javax.xml.parsers.SAXParserFactory;
31 import javax.xml.validation.Schema;
32 import org.xml.sax.SAXException;
41 * @author Rajiv Mordani
42 * @author Edwin Goei
43 *
44 */
45 public class SAXParserFactoryImpl extends SAXParserFactory {
46
47 /** Feature identifier: validation. */
48 private static final String VALIDATION_FEATURE =
49 Constants.SAX_FEATURE_PREFIX + Constants.VALIDATION_FEATURE;
50
51 /** Feature identifier: namespaces. */
52 private static final String NAMESPACES_FEATURE =
53 Constants.SAX_FEATURE_PREFIX + Constants.NAMESPACES_FEATURE;
54
55 /** Feature identifier: XInclude processing */
56 private static final String XINCLUDE_FEATURE =
57 Constants.XERCES_FEATURE_PREFIX + Constants.XINCLUDE_FEATURE;
58
59 private Map<String, Boolean> features;
60 private Schema grammar;
61 private boolean isXIncludeAware;
62
63 /**
64 * State of the secure processing feature, initially <code>false</code>
65 */
66 private boolean fSecureProcess = true;
67
68 /**
69 * Creates a new instance of <code>SAXParser</code> using the currently
70 * configured factory parameters.
71 * @return javax.xml.parsers.SAXParser
72 */
73 public SAXParser newSAXParser()
74 throws ParserConfigurationException
75 {
76 SAXParser saxParserImpl;
77 try {
78 saxParserImpl = new SAXParserImpl(this, features, fSecureProcess);
79 } catch (SAXException se) {
80 // Translate to ParserConfigurationException
81 throw new ParserConfigurationException(se.getMessage());
|
1 /*
2 * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
3 */
4 /*
5 * Licensed to the Apache Software Foundation (ASF) under one or more
6 * contributor license agreements. See the NOTICE file distributed with
7 * this work for additional information regarding copyright ownership.
8 * The ASF licenses this file to You under the Apache License, Version 2.0
9 * (the "License"); you may not use this file except in compliance with
10 * the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20
21 package com.sun.org.apache.xerces.internal.jaxp;
22
23 import com.sun.org.apache.xerces.internal.impl.Constants;
24 import com.sun.org.apache.xerces.internal.util.SAXMessageFormatter;
25 import java.util.HashMap;
26 import java.util.Map;
27 import javax.xml.XMLConstants;
28 import javax.xml.parsers.ParserConfigurationException;
29 import javax.xml.parsers.SAXParser;
30 import javax.xml.parsers.SAXParserFactory;
31 import javax.xml.validation.Schema;
32 import org.xml.sax.SAXException;
41 * @author Rajiv Mordani
42 * @author Edwin Goei
43 *
44 */
45 public class SAXParserFactoryImpl extends SAXParserFactory {
46
47 /** Feature identifier: validation. */
48 private static final String VALIDATION_FEATURE =
49 Constants.SAX_FEATURE_PREFIX + Constants.VALIDATION_FEATURE;
50
51 /** Feature identifier: namespaces. */
52 private static final String NAMESPACES_FEATURE =
53 Constants.SAX_FEATURE_PREFIX + Constants.NAMESPACES_FEATURE;
54
55 /** Feature identifier: XInclude processing */
56 private static final String XINCLUDE_FEATURE =
57 Constants.XERCES_FEATURE_PREFIX + Constants.XINCLUDE_FEATURE;
58
59 private Map<String, Boolean> features;
60 private Schema grammar;
61
62 /**
63 * State of the secure processing feature, initially <code>false</code>
64 */
65 private boolean fSecureProcess = true;
66
67 /**
68 * Creates a new instance of <code>SAXParser</code> using the currently
69 * configured factory parameters.
70 * @return javax.xml.parsers.SAXParser
71 */
72 public SAXParser newSAXParser()
73 throws ParserConfigurationException
74 {
75 SAXParser saxParserImpl;
76 try {
77 saxParserImpl = new SAXParserImpl(this, features, fSecureProcess);
78 } catch (SAXException se) {
79 // Translate to ParserConfigurationException
80 throw new ParserConfigurationException(se.getMessage());
|