21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 * or visit www.oracle.com if you need additional information or have any |
22 * or visit www.oracle.com if you need additional information or have any |
23 * questions. |
23 * questions. |
24 */ |
24 */ |
25 /* |
25 /* |
26 * Copyright (C) 2004-2011 |
26 * Copyright (C) 2004-2012 |
27 * |
27 * |
28 * Permission is hereby granted, free of charge, to any person obtaining a copy |
28 * Permission is hereby granted, free of charge, to any person obtaining a copy |
29 * of this software and associated documentation files (the "Software"), to deal |
29 * of this software and associated documentation files (the "Software"), to deal |
30 * in the Software without restriction, including without limitation the rights |
30 * in the Software without restriction, including without limitation the rights |
31 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
31 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
43 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
43 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
44 * THE SOFTWARE. |
44 * THE SOFTWARE. |
45 */ |
45 */ |
46 package com.sun.xml.internal.rngom.xml.sax; |
46 package com.sun.xml.internal.rngom.xml.sax; |
47 |
47 |
|
48 import java.util.logging.Level; |
|
49 import java.util.logging.Logger; |
|
50 import javax.xml.XMLConstants; |
48 import javax.xml.parsers.ParserConfigurationException; |
51 import javax.xml.parsers.ParserConfigurationException; |
49 import javax.xml.parsers.SAXParserFactory; |
52 import javax.xml.parsers.SAXParserFactory; |
50 |
53 |
51 import org.xml.sax.SAXException; |
54 import org.xml.sax.SAXException; |
|
55 import org.xml.sax.SAXNotRecognizedException; |
|
56 import org.xml.sax.SAXNotSupportedException; |
52 import org.xml.sax.XMLReader; |
57 import org.xml.sax.XMLReader; |
53 |
58 |
54 /** |
59 /** |
55 * {@link XMLReaderCreator} that uses JAXP to create |
60 * {@link XMLReaderCreator} that uses JAXP to create |
56 * {@link XMLReader}s. |
61 * {@link XMLReader}s. |
70 * Creates a {@link JAXPXMLReaderCreator} by using |
75 * Creates a {@link JAXPXMLReaderCreator} by using |
71 * {@link SAXParserFactory#newInstance()}. |
76 * {@link SAXParserFactory#newInstance()}. |
72 */ |
77 */ |
73 public JAXPXMLReaderCreator() { |
78 public JAXPXMLReaderCreator() { |
74 spf = SAXParserFactory.newInstance(); |
79 spf = SAXParserFactory.newInstance(); |
75 spf.setNamespaceAware(true); |
80 try { |
|
81 spf.setNamespaceAware(true); |
|
82 spf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); |
|
83 } catch (ParserConfigurationException ex) { |
|
84 Logger.getLogger(JAXPXMLReaderCreator.class.getName()).log(Level.SEVERE, null, ex); |
|
85 } catch (SAXNotRecognizedException ex) { |
|
86 Logger.getLogger(JAXPXMLReaderCreator.class.getName()).log(Level.SEVERE, null, ex); |
|
87 } catch (SAXNotSupportedException ex) { |
|
88 Logger.getLogger(JAXPXMLReaderCreator.class.getName()).log(Level.SEVERE, null, ex); |
|
89 } |
76 } |
90 } |
77 |
91 |
78 /** |
92 /** |
79 * @see com.sun.xml.internal.rngom.xml.sax.XMLReaderCreator#createXMLReader() |
93 * @see com.sun.xml.internal.rngom.xml.sax.XMLReaderCreator#createXMLReader() |
80 */ |
94 */ |