Hi.
>> I'm also interested in on-demand validation that would, for instance,
>> allow displaying detailed validation messages in a document editor.
>
> The problem that I have with this is that the JAXB on-demand validation
> is still based on XML validation. So errors are all found in terms of XML.
>
> For example, when you are missing the city property, the error is
> actually "unexpected <zip-code> element: <city> expected", and it just
> doesn't naturally translate to the level of errors that the application
> developers would be looking for (such as "property city is missing from
> this Address object, along with enough information to let him put the
> focus on the right Swing component.)
>
> Plus then there's an issue of further translating those errors to
> user-level error messages (such as "please type in a proper city name".)
> Furthermore, it is a very common for schemas to leave out some of the
> constraints.
You're right, that would be a preferrable way. Actually, the exception
raised when a missing object error is reported is already a good step
forward since it carries master object/property name information.
> Another thing is, those constraint checks on objects are by no means
> limited to JAXB --- you could have the same problem with Hibernate, for
> example.
The task might be the same, but JAXB is different, as it deals with
schematic models of object structures - including constraint
information. In principal, JAXB has enough information to construct
"object validator" you're mentioning below.
> I think it would be much nice if someone develops a framework to check
> constraints on a Java object graph. Then JAXB can produce a contraint
> set from a given schema. Such a framework would do a much better job of
> reporting errors, it would allow you to add more constraints, and it
> would have enough hook to connect errors to your application.
This seems to be a very good task, but quite complex, I'd say...
I've been working with XJC internals quite a lot last three month and
I'm not sure I have enough qualification/resources to implement such a
"constraint compiler".
Hm. I'll need to research this later...
Bye.
/lexi
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net