When using Xerces to validate using a XML Schema, the issues reported are very
cryptic because there has been no MessageFormatter set.
There is probably a very good reason to not set this MessageFormatter when the
XMLErrorReporter is initialised, possibly to allow the user to set it's own
message formatters; however ... just in case ... adding the following to the
ValidatorImpl constructor will fix this issue.
if (errorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) {
XMLMessageFormatter xmft = new XMLMessageFormatter();
errorReporter.putMessageFormatter(XMLMessageFormatter.XML_DOMAIN, xmft);
errorReporter.putMessageFormatter(XMLMessageFormatter.XMLNS_DOMAIN, xmft);
}
if (errorReporter.getMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN) ==
null) {
XSMessageFormatter xmft = new XSMessageFormatter();
errorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, xmft);
}
Kind regards,
Edwin
Original issue reported on code.google.com by edankert@gmail.com on 3 Oct 2012 at 10:00
Original issue reported on code.google.com by
edankert@gmail.com
on 3 Oct 2012 at 10:00