users@jaxb.java.net

Re: ValidationEventHandler returns only parent object through ValidationEvent.getLocator().getObject()

From: Aleksei Valikov <valikov_at_gmx.net>
Date: Mon, 04 Oct 2004 19:16:04 +0200

Hi.

> In a general case, you really need to run a state machine, for sometimes
> it is possible for a property to contain items of different kind (try a
> mixed complex type with some elaborated content model.) These general
> cases are very hard.

Ugum, I've already found a case like

<choice maxOccurs="unbounded">
   <element name="a" ... />
   <element name="b" minOccurs="5" maxOccurs="unbounded"/>
</choice>

which is quite awkward to process. Mixed content will be a problem, too.

However what I currently have in hands seems to support quite a large
subset of schema, I believe.

[about the datatype validation]

> The last but more ambitious approach is, for the most of the major
> datatypes, there's relatively straight-forward Java code to check the
> value object directly (IOW, check Java int instead of java.lang.String
> that looks like xs:int.)
>
> For example, checking the range of int is as easy as "x<100". So if you
> are willing to confine yourself to a subset of datatypes, then you can
> actually try to generate the code that validates datatype values
directly.
>
> This would look really nice, but you would probably find it difficult to
> support all the datatypes in this way. But then, that's probably OK in
> practice, as not all the datatypes are used equally, and not all the
> facets are used equally.

I like this approach most of all. I haven't examined the datatype
hierarchy yet, so can't estimate the work effort to implement "datatype
verifier code rendererers" for a meaningful subset of datatypes. But if
it's realistic, I'd opt to this solution.

Thanks for support, Kohsuke.

ps. Is Sun hiring? :) [joking]

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