The web-application I am currently working on, validates user-supplied xml files against xsd stored on a server. The problem is that if xml fails validation, error messages should be in Russian. I have my parser working - it gives error messages but only in English
String parserClass = "org.apache.xerces.parsers.SAXParser";
String validationFeature = "http://xml.org/sax/features/validation";
String schemaFeature = "http://apache.org/xml/features/validation/schema";
XMLReader reader = null;
reader = XMLReaderFactory.createXMLReader(parserClass);
reader.setFeature(validationFeature,true);
reader.setFeature(schemaFeature,true);
BatchContentHandler contentHandler = new BatchContentHandler(reader);
reader.setContentHandler(contentHandler);
BatchErrorHandler errorHandler = new BatchErrorHandler(reader);
reader.setErrorHandler(errorHandler);
reader.setFeature("http://apache.org/xml/features/continue-after-fatal-error", true);
reader.parse(new InputSource(new ByteArrayInputStream(streamedXML)));
It works fine - error messages are in English. Reading this post Locale specific messages in Xerces 2.11.0 (Java) and also this post https://www.java.net//node/699069 I added these lines
Locale l = new Locale("ru", "RU");
reader.setProperty("http://apache.org/xml/properties/locale", l);
I also added XMLSchemaMessages_RU.properties file to the jar. Now I get NULL pointer exception. Any ideas or hints? Thanks in advance!