users@jaxb.java.net

Re: JAXB - Automatic creation of mandatory children

From: Aleksei Valikov <valikov_at_gmx.net>
Date: Tue, 21 Sep 2004 12:07:55 +0200

Hi.

> Thanks for your reply.
> I am forced to create all the mandatory children
> because my XML will then become invalid. Moreover, I
> get an exception when I try to marshal/unmarshal an
> invalid XML.
> JAXB need not guess the default values at all. Infact
> all that I am doing right now is the following. To
> create an element A which has B and C as mandatory
> children:
> ObjectFactory of = new ObjectFactory();
> A a = of.newInstance(A.class);//0
> B b = of.newInstance(B.class)//1
> C c = of.newInstance(C.class)//2
> A.setB(b);//3
> A.setC(c);//4
>
> Cant JAXB do lines 1,2,3,4 automatically so that all I
> need to do then is just line 0.
>
> Please also let me know if it is possible to
> marshal/unmarshal an invalid xml incase I cant create
> these mandatory children automatically.

Actually seems like it is possible to marshal an invalid XML. It looks
like a bug in current RI. See my next posting.

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