Probably need to ask on the jaxb list. My gut feeling says that is fine. You pretty much would be logging all validation errors, but allowing them to go through. Should be OK to me.

Dan


On Jul 15, 2008, at 7:10 AM, [EMAIL PROTECTED] wrote:

Hello,

i have requirement to do xml schema validation, but in case of problem
only to log it, but continue serialization/deserialization. This is
beacause after enabling validation we found that some clients are not
sending requests valid against schema (e.g. are not sending elements,
instead of sending nil atribute, or are sending elements in wrong order etc). So we want to log all such problems and tell then client developer
where are problems....

I did following:
in JaxBEncoderDecoder i set
           u.setEventHandler(validationEventHandler);
after each
           u.setSchema(schema);

and declared (this will be extended):

private static final ValidationEventHandler validationEventHandler =
new ValidationEventHandler() {
       public boolean handleEvent(ValidationEvent event) {
               LOG.log(Level.SEVERE, "Validation Error:
[severity="+event.getSeverity()+", message='"+event.getMessage()+"',
location='"+event.getLocator()+"'].", event.getLinkedException());
               return true;
       }
   };

my question is if i can in general return true from handleEvent method. Because i'm afraid, that this method is called also in case of different
errors

best regards
jano

---
Daniel Kulp
[EMAIL PROTECTED]
http://www.dankulp.com/blog




Reply via email to