1 /*
2 * reserved comment block
3 * DO NOT REMOVE OR ALTER!
4 */
5 /*
6 * Licensed to the Apache Software Foundation (ASF) under one or more
7 * contributor license agreements. See the NOTICE file distributed with
8 * this work for additional information regarding copyright ownership.
9 * The ASF licenses this file to You under the Apache License, Version 2.0
10 * (the "License"); you may not use this file except in compliance with
11 * the License. You may obtain a copy of the License at
12 *
13 * http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 */
21
22 package com.sun.org.apache.xerces.internal.impl.dtd;
23
178 if(fEntityResolver instanceof XMLEntityManager) {
179 fEntityManager = (XMLEntityManager)fEntityResolver;
180 } else {
181 fEntityManager = new XMLEntityManager();
182 }
183 fEntityManager.setProperty(Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_REPORTER_PROPERTY, errorReporter);
184 fDTDScanner = createDTDScanner(fSymbolTable, fErrorReporter, fEntityManager);
185 fDTDScanner.setDTDHandler(this);
186 fDTDScanner.setDTDContentModelHandler(this);
187 reset();
188 } // init(SymbolTable, XMLGrammarPool, XMLErrorReporter, XMLEntityResolver)
189
190 // XMLGrammarLoader methods
191
192 /**
193 * Returns a list of feature identifiers that are recognized by
194 * this component. This method may return null if no features
195 * are recognized by this component.
196 */
197 public String[] getRecognizedFeatures() {
198 return (String[])(LOADER_RECOGNIZED_FEATURES.clone());
199 } // getRecognizedFeatures():String[]
200
201 /**
202 * Sets the state of a feature. This method is called by the component
203 * manager any time after reset when a feature changes state.
204 * <p>
205 * <strong>Note:</strong> Components should silently ignore features
206 * that do not affect the operation of the component.
207 *
208 * @param featureId The feature identifier.
209 * @param state The state of the feature.
210 *
211 * @throws SAXNotRecognizedException The component should not throw
212 * this exception.
213 * @throws SAXNotSupportedException The component should not throw
214 * this exception.
215 */
216 public void setFeature(String featureId, boolean state)
217 throws XMLConfigurationException {
218 if (featureId.equals(VALIDATION)) {
227 else if (featureId.equals(NOTIFY_CHAR_REFS)) {
228 fDTDScanner.setFeature(featureId, state);
229 }
230 else if (featureId.equals(STANDARD_URI_CONFORMANT_FEATURE)) {
231 fStrictURI = state;
232 }
233 else if (featureId.equals(BALANCE_SYNTAX_TREES)) {
234 fBalanceSyntaxTrees = state;
235 }
236 else {
237 throw new XMLConfigurationException(Status.NOT_RECOGNIZED, featureId);
238 }
239 } // setFeature(String,boolean)
240
241 /**
242 * Returns a list of property identifiers that are recognized by
243 * this component. This method may return null if no properties
244 * are recognized by this component.
245 */
246 public String[] getRecognizedProperties() {
247 return (String[])(LOADER_RECOGNIZED_PROPERTIES.clone());
248 } // getRecognizedProperties():String[]
249
250 /**
251 * Returns the state of a property.
252 *
253 * @param propertyId The property identifier.
254 *
255 * @throws XMLConfigurationException Thrown on configuration error.
256 */
257 public Object getProperty(String propertyId)
258 throws XMLConfigurationException {
259 if (propertyId.equals(SYMBOL_TABLE)) {
260 return fSymbolTable;
261 }
262 else if (propertyId.equals(ERROR_REPORTER)) {
263 return fErrorReporter;
264 }
265 else if (propertyId.equals(ERROR_HANDLER)) {
266 return fErrorReporter.getErrorHandler();
267 }
|
1 /*
2 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
3 * @LastModified: Nov 2017
4 */
5 /*
6 * Licensed to the Apache Software Foundation (ASF) under one or more
7 * contributor license agreements. See the NOTICE file distributed with
8 * this work for additional information regarding copyright ownership.
9 * The ASF licenses this file to You under the Apache License, Version 2.0
10 * (the "License"); you may not use this file except in compliance with
11 * the License. You may obtain a copy of the License at
12 *
13 * http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 */
21
22 package com.sun.org.apache.xerces.internal.impl.dtd;
23
178 if(fEntityResolver instanceof XMLEntityManager) {
179 fEntityManager = (XMLEntityManager)fEntityResolver;
180 } else {
181 fEntityManager = new XMLEntityManager();
182 }
183 fEntityManager.setProperty(Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_REPORTER_PROPERTY, errorReporter);
184 fDTDScanner = createDTDScanner(fSymbolTable, fErrorReporter, fEntityManager);
185 fDTDScanner.setDTDHandler(this);
186 fDTDScanner.setDTDContentModelHandler(this);
187 reset();
188 } // init(SymbolTable, XMLGrammarPool, XMLErrorReporter, XMLEntityResolver)
189
190 // XMLGrammarLoader methods
191
192 /**
193 * Returns a list of feature identifiers that are recognized by
194 * this component. This method may return null if no features
195 * are recognized by this component.
196 */
197 public String[] getRecognizedFeatures() {
198 return LOADER_RECOGNIZED_FEATURES.clone();
199 } // getRecognizedFeatures():String[]
200
201 /**
202 * Sets the state of a feature. This method is called by the component
203 * manager any time after reset when a feature changes state.
204 * <p>
205 * <strong>Note:</strong> Components should silently ignore features
206 * that do not affect the operation of the component.
207 *
208 * @param featureId The feature identifier.
209 * @param state The state of the feature.
210 *
211 * @throws SAXNotRecognizedException The component should not throw
212 * this exception.
213 * @throws SAXNotSupportedException The component should not throw
214 * this exception.
215 */
216 public void setFeature(String featureId, boolean state)
217 throws XMLConfigurationException {
218 if (featureId.equals(VALIDATION)) {
227 else if (featureId.equals(NOTIFY_CHAR_REFS)) {
228 fDTDScanner.setFeature(featureId, state);
229 }
230 else if (featureId.equals(STANDARD_URI_CONFORMANT_FEATURE)) {
231 fStrictURI = state;
232 }
233 else if (featureId.equals(BALANCE_SYNTAX_TREES)) {
234 fBalanceSyntaxTrees = state;
235 }
236 else {
237 throw new XMLConfigurationException(Status.NOT_RECOGNIZED, featureId);
238 }
239 } // setFeature(String,boolean)
240
241 /**
242 * Returns a list of property identifiers that are recognized by
243 * this component. This method may return null if no properties
244 * are recognized by this component.
245 */
246 public String[] getRecognizedProperties() {
247 return LOADER_RECOGNIZED_PROPERTIES.clone();
248 } // getRecognizedProperties():String[]
249
250 /**
251 * Returns the state of a property.
252 *
253 * @param propertyId The property identifier.
254 *
255 * @throws XMLConfigurationException Thrown on configuration error.
256 */
257 public Object getProperty(String propertyId)
258 throws XMLConfigurationException {
259 if (propertyId.equals(SYMBOL_TABLE)) {
260 return fSymbolTable;
261 }
262 else if (propertyId.equals(ERROR_REPORTER)) {
263 return fErrorReporter;
264 }
265 else if (propertyId.equals(ERROR_HANDLER)) {
266 return fErrorReporter.getErrorHandler();
267 }
|