18 * limitations under the License. |
18 * limitations under the License. |
19 */ |
19 */ |
20 |
20 |
21 package com.sun.org.apache.xerces.internal.dom; |
21 package com.sun.org.apache.xerces.internal.dom; |
22 |
22 |
23 import java.io.IOException; |
|
24 import java.util.ArrayList; |
|
25 import java.util.HashMap; |
|
26 import java.util.Locale; |
|
27 import java.util.Vector; |
|
28 |
|
29 import com.sun.org.apache.xerces.internal.util.PropertyState; |
|
30 import com.sun.org.apache.xerces.internal.util.Status; |
|
31 import org.w3c.dom.DOMConfiguration; |
|
32 import org.w3c.dom.DOMErrorHandler; |
|
33 import org.w3c.dom.DOMStringList; |
|
34 |
|
35 import com.sun.org.apache.xerces.internal.impl.Constants; |
23 import com.sun.org.apache.xerces.internal.impl.Constants; |
36 import com.sun.org.apache.xerces.internal.impl.XMLEntityManager; |
24 import com.sun.org.apache.xerces.internal.impl.XMLEntityManager; |
37 import com.sun.org.apache.xerces.internal.impl.XMLErrorReporter; |
25 import com.sun.org.apache.xerces.internal.impl.XMLErrorReporter; |
38 import com.sun.org.apache.xerces.internal.impl.dv.DTDDVFactory; |
26 import com.sun.org.apache.xerces.internal.impl.dv.DTDDVFactory; |
39 import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter; |
27 import com.sun.org.apache.xerces.internal.impl.msg.XMLMessageFormatter; |
40 import com.sun.org.apache.xerces.internal.impl.validation.ValidationManager; |
28 import com.sun.org.apache.xerces.internal.impl.validation.ValidationManager; |
41 import com.sun.org.apache.xerces.internal.util.DOMEntityResolverWrapper; |
29 import com.sun.org.apache.xerces.internal.util.DOMEntityResolverWrapper; |
42 import com.sun.org.apache.xerces.internal.util.DOMErrorHandlerWrapper; |
30 import com.sun.org.apache.xerces.internal.util.DOMErrorHandlerWrapper; |
43 import com.sun.org.apache.xerces.internal.util.MessageFormatter; |
31 import com.sun.org.apache.xerces.internal.util.MessageFormatter; |
44 import com.sun.org.apache.xerces.internal.util.ParserConfigurationSettings; |
32 import com.sun.org.apache.xerces.internal.util.ParserConfigurationSettings; |
|
33 import com.sun.org.apache.xerces.internal.util.PropertyState; |
45 import com.sun.org.apache.xerces.internal.util.SymbolTable; |
34 import com.sun.org.apache.xerces.internal.util.SymbolTable; |
|
35 import com.sun.org.apache.xerces.internal.utils.ObjectFactory; |
|
36 import com.sun.org.apache.xerces.internal.utils.SecuritySupport; |
46 import com.sun.org.apache.xerces.internal.xni.XMLDTDContentModelHandler; |
37 import com.sun.org.apache.xerces.internal.xni.XMLDTDContentModelHandler; |
47 import com.sun.org.apache.xerces.internal.xni.XMLDTDHandler; |
38 import com.sun.org.apache.xerces.internal.xni.XMLDTDHandler; |
48 import com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler; |
39 import com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler; |
49 import com.sun.org.apache.xerces.internal.xni.XNIException; |
40 import com.sun.org.apache.xerces.internal.xni.XNIException; |
50 import com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarPool; |
41 import com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarPool; |
53 import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException; |
44 import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException; |
54 import com.sun.org.apache.xerces.internal.xni.parser.XMLEntityResolver; |
45 import com.sun.org.apache.xerces.internal.xni.parser.XMLEntityResolver; |
55 import com.sun.org.apache.xerces.internal.xni.parser.XMLErrorHandler; |
46 import com.sun.org.apache.xerces.internal.xni.parser.XMLErrorHandler; |
56 import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource; |
47 import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource; |
57 import com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration; |
48 import com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration; |
58 import com.sun.org.apache.xerces.internal.utils.ObjectFactory; |
49 import java.io.IOException; |
|
50 import java.util.ArrayList; |
|
51 import java.util.HashMap; |
|
52 import java.util.Locale; |
|
53 import java.util.Vector; |
|
54 import javax.xml.XMLConstants; |
|
55 import org.w3c.dom.DOMConfiguration; |
|
56 import org.w3c.dom.DOMErrorHandler; |
59 import org.w3c.dom.DOMException; |
57 import org.w3c.dom.DOMException; |
|
58 import org.w3c.dom.DOMStringList; |
60 import org.w3c.dom.ls.LSResourceResolver; |
59 import org.w3c.dom.ls.LSResourceResolver; |
61 |
|
62 |
60 |
63 |
61 |
64 /** |
62 /** |
65 * Xerces implementation of DOMConfiguration that maintains a table of recognized parameters. |
63 * Xerces implementation of DOMConfiguration that maintains a table of recognized parameters. |
66 * |
64 * |
155 Constants.XERCES_PROPERTY_PREFIX + Constants.VALIDATION_MANAGER_PROPERTY; |
153 Constants.XERCES_PROPERTY_PREFIX + Constants.VALIDATION_MANAGER_PROPERTY; |
156 |
154 |
157 /** Property identifier: Schema DV Factory */ |
155 /** Property identifier: Schema DV Factory */ |
158 protected static final String SCHEMA_DV_FACTORY = |
156 protected static final String SCHEMA_DV_FACTORY = |
159 Constants.XERCES_PROPERTY_PREFIX + Constants.SCHEMA_DV_FACTORY_PROPERTY; |
157 Constants.XERCES_PROPERTY_PREFIX + Constants.SCHEMA_DV_FACTORY_PROPERTY; |
|
158 |
|
159 /** Property identifier: access to external dtd */ |
|
160 protected static final String ACCESS_EXTERNAL_DTD = |
|
161 XMLConstants.ACCESS_EXTERNAL_DTD; |
|
162 |
|
163 /** Property identifier: access to external schema */ |
|
164 protected static final String ACCESS_EXTERNAL_SCHEMA = |
|
165 XMLConstants.ACCESS_EXTERNAL_SCHEMA; |
160 |
166 |
161 // |
167 // |
162 // Data |
168 // Data |
163 // |
169 // |
164 XMLDocumentHandler fDocumentHandler; |
170 XMLDocumentHandler fDocumentHandler; |
274 VALIDATION_MANAGER, |
280 VALIDATION_MANAGER, |
275 GRAMMAR_POOL, |
281 GRAMMAR_POOL, |
276 JAXP_SCHEMA_SOURCE, |
282 JAXP_SCHEMA_SOURCE, |
277 JAXP_SCHEMA_LANGUAGE, |
283 JAXP_SCHEMA_LANGUAGE, |
278 DTD_VALIDATOR_FACTORY_PROPERTY, |
284 DTD_VALIDATOR_FACTORY_PROPERTY, |
279 SCHEMA_DV_FACTORY |
285 SCHEMA_DV_FACTORY, |
|
286 ACCESS_EXTERNAL_DTD, |
|
287 ACCESS_EXTERNAL_SCHEMA |
280 }; |
288 }; |
281 addRecognizedProperties(recognizedProperties); |
289 addRecognizedProperties(recognizedProperties); |
282 |
290 |
283 // set default values for normalization features |
291 // set default values for normalization features |
284 features |= NAMESPACES; |
292 features |= NAMESPACES; |
308 addComponent(manager); |
316 addComponent(manager); |
309 |
317 |
310 fValidationManager = createValidationManager(); |
318 fValidationManager = createValidationManager(); |
311 setProperty(VALIDATION_MANAGER, fValidationManager); |
319 setProperty(VALIDATION_MANAGER, fValidationManager); |
312 |
320 |
|
321 //For DOM, the secure feature is set to true by default |
|
322 String accessExternal = SecuritySupport.getDefaultAccessProperty( |
|
323 Constants.SP_ACCESS_EXTERNAL_DTD, Constants.EXTERNAL_ACCESS_DEFAULT); |
|
324 setProperty(ACCESS_EXTERNAL_DTD, accessExternal); |
|
325 |
|
326 accessExternal = SecuritySupport.getDefaultAccessProperty( |
|
327 Constants.SP_ACCESS_EXTERNAL_SCHEMA, Constants.EXTERNAL_ACCESS_DEFAULT); |
|
328 setProperty(ACCESS_EXTERNAL_SCHEMA, accessExternal); |
313 |
329 |
314 // add message formatters |
330 // add message formatters |
315 if (fErrorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) { |
331 if (fErrorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) { |
316 XMLMessageFormatter xmft = new XMLMessageFormatter(); |
332 XMLMessageFormatter xmft = new XMLMessageFormatter(); |
317 fErrorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft); |
333 fErrorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft); |