|
Lines 36-49
import javax.xml.validation.Schema;
Link Here
|
| 36 |
import javax.xml.validation.SchemaFactory; |
36 |
import javax.xml.validation.SchemaFactory; |
| 37 |
|
37 |
|
| 38 |
import org.eclipse.persistence.config.PersistenceUnitProperties; |
38 |
import org.eclipse.persistence.config.PersistenceUnitProperties; |
|
|
39 |
import org.eclipse.persistence.exceptions.EclipseLinkException; |
| 39 |
import org.eclipse.persistence.exceptions.ValidationException; |
40 |
import org.eclipse.persistence.exceptions.ValidationException; |
| 40 |
import org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider; |
41 |
import org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider; |
| 41 |
|
42 |
|
| 42 |
import org.eclipse.persistence.oxm.XMLConstants; |
43 |
import org.eclipse.persistence.oxm.XMLConstants; |
| 43 |
import org.eclipse.persistence.oxm.XMLContext; |
44 |
import org.eclipse.persistence.oxm.XMLContext; |
| 44 |
import org.eclipse.persistence.oxm.XMLUnmarshaller; |
45 |
import org.eclipse.persistence.oxm.XMLUnmarshaller; |
|
|
46 |
import org.xml.sax.ErrorHandler; |
| 45 |
import org.xml.sax.InputSource; |
47 |
import org.xml.sax.InputSource; |
| 46 |
import org.xml.sax.SAXException; |
48 |
import org.xml.sax.SAXException; |
|
|
49 |
import org.xml.sax.SAXParseException; |
| 47 |
import org.xml.sax.XMLReader; |
50 |
import org.xml.sax.XMLReader; |
| 48 |
|
51 |
|
| 49 |
/** |
52 |
/** |
|
Lines 214-219
public class XMLEntityMappingsReader {
Link Here
|
| 214 |
*/ |
217 |
*/ |
| 215 |
private static void useLocalSchemaForUnmarshaller(XMLUnmarshaller unmarshaller, Schema schema) { |
218 |
private static void useLocalSchemaForUnmarshaller(XMLUnmarshaller unmarshaller, Schema schema) { |
| 216 |
try { |
219 |
try { |
|
|
220 |
|
| 221 |
unmarshaller.setErrorHandler(new ErrorHandler() { |
| 222 |
@Override |
| 223 |
public void error(SAXParseException exception) throws SAXException { |
| 224 |
throw exception; |
| 225 |
} |
| 226 |
|
| 227 |
@Override |
| 228 |
public void fatalError(SAXParseException exception) throws SAXException { |
| 229 |
throw exception; |
| 230 |
} |
| 231 |
|
| 232 |
@Override |
| 233 |
public void warning(SAXParseException exception) throws SAXException { |
| 234 |
if (exception.getException() instanceof EclipseLinkException) { |
| 235 |
throw (EclipseLinkException) exception.getCause(); |
| 236 |
} |
| 237 |
} |
| 238 |
}); |
| 239 |
|
| 217 |
unmarshaller.setSchema(schema); |
240 |
unmarshaller.setSchema(schema); |
| 218 |
} catch (UnsupportedOperationException ex) { |
241 |
} catch (UnsupportedOperationException ex) { |
| 219 |
// Some parsers do not support setSchema. In that case, setup validation another way. |
242 |
// Some parsers do not support setSchema. In that case, setup validation another way. |
| 220 |
- |
|
|