users@jaxb.java.net

Re: JAXB - Automatic creation of mandatory children

From: Aleksei Valikov <valikov_at_gmx.net>
Date: Wed, 22 Sep 2004 09:59:40 +0200

Hi.

>>Could you please elaborate on why are you forced to create
>>all mandatory children.

George Datuashvili wrote:

> One example is use of separator elements for schema versioning and
> extensiblity support. Because of XSD unique particle attribution rule
> such patterns is one of the most reasonable ways to deal with version
> and extensiblity. Then it's annoying and error prone if xml/object
> mapping technology insists on populating all the dummy elements by hand,
> even though it could be done automatically.
>
> For more details see use of <bc:delimiter/> on the last xml fragment
> here:
> http://www.xml.com/pub/a/2004/07/21/design.html?page=3

I basically asked about which problem arizes when trying to marshall an
invalid document.

Concerning the automatic creation of mandatory children. The problem is
actually a bit deeper. The truth is that you don't need to create
mandatory children. Your ultimate goal is a valid structure which is not
limited to creating the mandatory children. You also need correct data
fulfilling simple type constraints and so on. And in my opinion JAXB
could not guess those values for you.

My idea to resolve this type of problems would be using some kind of
"default" XML fragments. I mean, you could create defaulting xml
fragments per hand and add them to resources. These fragment will then
be used when creating new objects to default their values/children/whatever.

That's a very rough idea. Actually, in my current project I have a
similar task, but it is scheduled a bit later. I'll post my results when
I have some.

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