18
18
*/
19
19
package com .runwaysdk .dataaccess .io ;
20
20
21
+ import javax .xml .parsers .ParserConfigurationException ;
22
+ import javax .xml .parsers .SAXParser ;
23
+ import javax .xml .parsers .SAXParserFactory ;
24
+
21
25
import org .xml .sax .InputSource ;
22
26
import org .xml .sax .Locator ;
23
27
import org .xml .sax .SAXException ;
24
28
import org .xml .sax .SAXParseException ;
25
29
import org .xml .sax .XMLFilter ;
26
30
import org .xml .sax .XMLReader ;
27
31
import org .xml .sax .helpers .DefaultHandler ;
28
- import org .xml .sax .helpers .XMLReaderFactory ;
29
32
30
33
/**
31
34
* Parent Handler Class all othere Handlers extend from. Keeps data that is universal to all Handlers.
@@ -83,15 +86,16 @@ public class XMLHandler extends DefaultHandler
83
86
* fully qualified path of the schema file
84
87
*
85
88
* @throws SAXException
89
+ * @throws ParserConfigurationException
86
90
*/
87
- public XMLHandler (StreamSource source , String schemaLocation ) throws SAXException
91
+ public XMLHandler (StreamSource source , String schemaLocation ) throws SAXException , ParserConfigurationException
88
92
{
89
93
this (new ImportManager (source , schemaLocation ));
90
94
91
95
streamSource = source ;
92
96
}
93
97
94
- public XMLHandler (StreamSource source , String schemaLocation , XMLFilter filter ) throws SAXException
98
+ public XMLHandler (StreamSource source , String schemaLocation , XMLFilter filter ) throws SAXException , ParserConfigurationException
95
99
{
96
100
this (new ImportManager (source , schemaLocation ), filter );
97
101
@@ -104,28 +108,29 @@ public XMLHandler(StreamSource source, String schemaLocation, XMLFilter filter)
104
108
* @param manager
105
109
* The manager of the import. Contains the filename, schema location, and the status of the import
106
110
* @throws SAXException
111
+ * @throws ParserConfigurationException
107
112
*/
108
- public XMLHandler (ImportManager manager ) throws SAXException
113
+ public XMLHandler (ImportManager manager ) throws SAXException , ParserConfigurationException
109
114
{
110
115
reader = createReader ();
111
116
112
- reader .setFeature (SCHEMA_VALIDATION_FEATURE_ID , true );
113
- reader .setFeature (VALIDATION_FEATURE_ID , true );
114
- reader .setEntityResolver (new RunwayClasspathEntityResolver ());
117
+ // reader.setFeature(SCHEMA_VALIDATION_FEATURE_ID, true);
118
+ // reader.setFeature(VALIDATION_FEATURE_ID, true);
119
+ // reader.setEntityResolver(new RunwayClasspathEntityResolver());
115
120
116
121
// Root Handler
117
122
this .previousHandler = null ;
118
123
this .manager = manager ;
119
124
}
120
125
121
- public XMLHandler (ImportManager manager , XMLFilter filter ) throws SAXException
126
+ public XMLHandler (ImportManager manager , XMLFilter filter ) throws SAXException , ParserConfigurationException
122
127
{
123
128
filter .setParent (this .createReader ());
124
129
reader = filter ;
125
130
126
- reader .setFeature (SCHEMA_VALIDATION_FEATURE_ID , true );
127
- reader .setFeature (VALIDATION_FEATURE_ID , true );
128
- reader .setEntityResolver (new RunwayClasspathEntityResolver ());
131
+ // reader.setFeature(SCHEMA_VALIDATION_FEATURE_ID, true);
132
+ // reader.setFeature(VALIDATION_FEATURE_ID, true);
133
+ // reader.setEntityResolver(new RunwayClasspathEntityResolver());
129
134
130
135
// Root Handler
131
136
this .previousHandler = null ;
@@ -137,9 +142,13 @@ protected XMLHandler()
137
142
138
143
}
139
144
140
- protected XMLReader createReader () throws SAXException
145
+ protected XMLReader createReader () throws SAXException , ParserConfigurationException
141
146
{
142
- return XMLReaderFactory .createXMLReader (READER );
147
+ SAXParserFactory parserFactory = SAXParserFactory .newInstance ();
148
+ parserFactory .setValidating (false );
149
+
150
+ SAXParser parser = parserFactory .newSAXParser ();
151
+ return parser .getXMLReader ();
143
152
}
144
153
145
154
/**
0 commit comments