SAXParseException本地化 [英] SAXParseException localized
问题描述
exception.getMessage()$ c生成具有解析器错误列表( SAXParseException
)的报告$ c>( exception.getLocalizedMessage()
返回相同),可以由人类阅读和理解。如何使用英语以外的语言本地化此异常消息?解决方案我找到了解决方案。首先需要从 Apache Xerces
获取 XMLSchemaMessages.properties
。我从 Xerces-J-src.2.11.0.tar.gz
> http://xerces.apache.org/ ,解压缩并从位置获取此文件: ... \src\org\apache\xerces\impl\ msg
。 现在将此文件重命名为 XMLSchemaMessages_pl.properties 或本地化您需要并放在classpath中。我在Maven中有项目,所以我把这个文件放到: src\main\resources\com\sun\org\apache\xerces\internal\impl\msg
。
这就是全部。对此文件的更改将在异常消息中显示。
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 ?
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.
这篇关于SAXParseException本地化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!