jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/parsers/DTDConfiguration.java
equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * reserved comment block |
2 * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT REMOVE OR ALTER! |
|
4 */ |
3 */ |
5 /* |
4 /* |
6 * Copyright 2001-2004 The Apache Software Foundation. |
5 * Licensed to the Apache Software Foundation (ASF) under one or more |
7 * |
6 * contributor license agreements. See the NOTICE file distributed with |
8 * Licensed under the Apache License, Version 2.0 (the "License"); |
7 * this work for additional information regarding copyright ownership. |
9 * you may not use this file except in compliance with the License. |
8 * The ASF licenses this file to You under the Apache License, Version 2.0 |
10 * You may obtain a copy of the License at |
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 * |
11 * |
12 * http://www.apache.org/licenses/LICENSE-2.0 |
12 * http://www.apache.org/licenses/LICENSE-2.0 |
13 * |
13 * |
14 * Unless required by applicable law or agreed to in writing, software |
14 * Unless required by applicable law or agreed to in writing, software |
15 * distributed under the License is distributed on an "AS IS" BASIS, |
15 * distributed under the License is distributed on an "AS IS" BASIS, |
34 import com.sun.org.apache.xerces.internal.impl.dv.DTDDVFactory; |
34 import com.sun.org.apache.xerces.internal.impl.dv.DTDDVFactory; |
35 import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter; |
35 import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter; |
36 import com.sun.org.apache.xerces.internal.impl.validation.ValidationManager; |
36 import com.sun.org.apache.xerces.internal.impl.validation.ValidationManager; |
37 import com.sun.org.apache.xerces.internal.util.FeatureState; |
37 import com.sun.org.apache.xerces.internal.util.FeatureState; |
38 import com.sun.org.apache.xerces.internal.util.PropertyState; |
38 import com.sun.org.apache.xerces.internal.util.PropertyState; |
39 import com.sun.org.apache.xerces.internal.util.Status; |
|
40 import com.sun.org.apache.xerces.internal.util.SymbolTable; |
39 import com.sun.org.apache.xerces.internal.util.SymbolTable; |
41 import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager; |
40 import com.sun.org.apache.xerces.internal.utils.XMLSecurityPropertyManager; |
42 import com.sun.org.apache.xerces.internal.xni.XMLLocator; |
41 import com.sun.org.apache.xerces.internal.xni.XMLLocator; |
43 import com.sun.org.apache.xerces.internal.xni.XNIException; |
42 import com.sun.org.apache.xerces.internal.xni.XNIException; |
44 import com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarPool; |
43 import com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarPool; |
47 import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException; |
46 import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException; |
48 import com.sun.org.apache.xerces.internal.xni.parser.XMLDTDScanner; |
47 import com.sun.org.apache.xerces.internal.xni.parser.XMLDTDScanner; |
49 import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentScanner; |
48 import com.sun.org.apache.xerces.internal.xni.parser.XMLDocumentScanner; |
50 import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource; |
49 import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource; |
51 import com.sun.org.apache.xerces.internal.xni.parser.XMLPullParserConfiguration; |
50 import com.sun.org.apache.xerces.internal.xni.parser.XMLPullParserConfiguration; |
|
51 import javax.xml.XMLConstants; |
|
52 import javax.xml.catalog.CatalogFeatures; |
|
53 import jdk.xml.internal.JdkXmlUtils; |
52 |
54 |
53 /** |
55 /** |
54 * This is the DTD-only parser configuration. It extends the basic |
56 * This is the DTD-only parser configuration. It extends the basic |
55 * configuration with a standard set of parser components appropriate |
57 * configuration with a standard set of parser components appropriate |
56 * to DTD-centric validation. Since |
58 * to DTD-centric validation. Since |
306 CONTINUE_AFTER_FATAL_ERROR, |
308 CONTINUE_AFTER_FATAL_ERROR, |
307 LOAD_EXTERNAL_DTD, // from XMLDTDScannerImpl |
309 LOAD_EXTERNAL_DTD, // from XMLDTDScannerImpl |
308 //NOTIFY_BUILTIN_REFS, // from XMLDocumentFragmentScannerImpl |
310 //NOTIFY_BUILTIN_REFS, // from XMLDocumentFragmentScannerImpl |
309 //NOTIFY_CHAR_REFS, // from XMLDocumentFragmentScannerImpl |
311 //NOTIFY_CHAR_REFS, // from XMLDocumentFragmentScannerImpl |
310 //WARN_ON_DUPLICATE_ENTITYDEF, // from XMLEntityManager |
312 //WARN_ON_DUPLICATE_ENTITYDEF, // from XMLEntityManager |
|
313 XMLConstants.USE_CATALOG |
311 }; |
314 }; |
312 addRecognizedFeatures(recognizedFeatures); |
315 addRecognizedFeatures(recognizedFeatures); |
313 |
316 |
314 // set state for default features |
317 // set state for default features |
315 //setFeature(WARN_ON_DUPLICATE_ATTDEF, false); // from XMLDTDScannerImpl |
318 //setFeature(WARN_ON_DUPLICATE_ATTDEF, false); // from XMLDTDScannerImpl |
318 setFeature(CONTINUE_AFTER_FATAL_ERROR, false); |
321 setFeature(CONTINUE_AFTER_FATAL_ERROR, false); |
319 setFeature(LOAD_EXTERNAL_DTD, true); // from XMLDTDScannerImpl |
322 setFeature(LOAD_EXTERNAL_DTD, true); // from XMLDTDScannerImpl |
320 //setFeature(NOTIFY_BUILTIN_REFS, false); // from XMLDocumentFragmentScannerImpl |
323 //setFeature(NOTIFY_BUILTIN_REFS, false); // from XMLDocumentFragmentScannerImpl |
321 //setFeature(NOTIFY_CHAR_REFS, false); // from XMLDocumentFragmentScannerImpl |
324 //setFeature(NOTIFY_CHAR_REFS, false); // from XMLDocumentFragmentScannerImpl |
322 //setFeature(WARN_ON_DUPLICATE_ENTITYDEF, false); // from XMLEntityManager |
325 //setFeature(WARN_ON_DUPLICATE_ENTITYDEF, false); // from XMLEntityManager |
|
326 fFeatures.put(XMLConstants.USE_CATALOG, JdkXmlUtils.USE_CATALOG_DEFAULT); |
323 |
327 |
324 // add default recognized properties |
328 // add default recognized properties |
325 final String[] recognizedProperties = { |
329 final String[] recognizedProperties = { |
326 ERROR_REPORTER, |
330 ERROR_REPORTER, |
327 ENTITY_MANAGER, |
331 ENTITY_MANAGER, |
335 VALIDATION_MANAGER, |
339 VALIDATION_MANAGER, |
336 JAXP_SCHEMA_SOURCE, |
340 JAXP_SCHEMA_SOURCE, |
337 JAXP_SCHEMA_LANGUAGE, |
341 JAXP_SCHEMA_LANGUAGE, |
338 LOCALE, |
342 LOCALE, |
339 SECURITY_MANAGER, |
343 SECURITY_MANAGER, |
340 XML_SECURITY_PROPERTY_MANAGER |
344 XML_SECURITY_PROPERTY_MANAGER, |
|
345 JdkXmlUtils.CATALOG_DEFER, |
|
346 JdkXmlUtils.CATALOG_FILES, |
|
347 JdkXmlUtils.CATALOG_PREFER, |
|
348 JdkXmlUtils.CATALOG_RESOLVE |
341 }; |
349 }; |
342 addRecognizedProperties(recognizedProperties); |
350 addRecognizedProperties(recognizedProperties); |
343 |
351 |
344 fGrammarPool = grammarPool; |
352 fGrammarPool = grammarPool; |
345 if(fGrammarPool != null){ |
353 if(fGrammarPool != null){ |
414 // do nothing |
422 // do nothing |
415 // REVISIT: What is the right thing to do? -Ac |
423 // REVISIT: What is the right thing to do? -Ac |
416 } |
424 } |
417 |
425 |
418 setProperty(XML_SECURITY_PROPERTY_MANAGER, new XMLSecurityPropertyManager()); |
426 setProperty(XML_SECURITY_PROPERTY_MANAGER, new XMLSecurityPropertyManager()); |
|
427 |
|
428 // Initialize Catalog features |
|
429 for( CatalogFeatures.Feature f : CatalogFeatures.Feature.values()) { |
|
430 setProperty(f.getPropertyName(), null); |
|
431 } |
419 } // <init>(SymbolTable,XMLGrammarPool) |
432 } // <init>(SymbolTable,XMLGrammarPool) |
420 |
433 |
421 // |
434 // |
422 // Public methods |
435 // Public methods |
423 // |
436 // |