javaexception

SAXParseException localized


I have service that parse XML and produce report with list of parser errors (SAXParseException exactly) using exception.getMessage() (exception.getLocalizedMessage() return the same) that can be read and understand by humans. How to localize this exception messages in a language other than English ?


Solution

  • I've found solution. First need to get XMLSchemaMessages.properties from Apache Xerces. I downloaded Xerces-J-src.2.11.0.tar.gz from http://xerces.apache.org/, unzip and get this file from location: ...\src\org\apache\xerces\impl\msg.

    Now rename this file to XMLSchemaMessages_pl.properties or localization You need and place in classpath. I have project in Maven so i put this file into: src\main\resources\com\sun\org\apache\xerces\internal\impl\msg.

    And that's all. Changes to this file will be visible in exception messages.