I want to provide my own message from the validation done in DocumentBuilder
, rather than the one from XMLMessages.properties
.
我想从DocumentBuilder中完成的验证中提供自己的消息,而不是XMLMessages.properties中的消息。
Now I see that a property error-reporter
needs to be set to a class which extends XMLErrorReporter
.
现在我看到属性error-reporter需要设置为扩展XMLErrorReporter的类。
However, I've not been able to get ComponentManager
from Document
/Builder
/Factory
.
但是,我无法从Document / Builder / Factory获取ComponentManager。
Doing parsing of string in SAXParseException
is the last option, but I'm just thinking there may be a 'best practice' way of doing it.
在SAXParseException中解析字符串是最后一个选项,但我只是认为可能有一种“最佳实践”的方法。
1 个解决方案
#1
2
have you already looked at DocumentBuilder#setErrorHandler?
你已经看过DocumentBuilder#setErrorHandler了吗?
if yes, could you explain why this approach doesn't work for you?
如果是的话,你能解释为什么这种方法对你不起作用吗?
#1
2
have you already looked at DocumentBuilder#setErrorHandler?
你已经看过DocumentBuilder#setErrorHandler了吗?
if yes, could you explain why this approach doesn't work for you?
如果是的话,你能解释为什么这种方法对你不起作用吗?