users@jaxb.java.net

Re: JAXB - Automatic creation of mandatory children

From: Aleksei Valikov <valikov_at_gmx.net>
Date: Tue, 21 Sep 2004 13:58:41 +0200

Hi.

> I am doing the following after setting the
> validationHandler for both the marshaller and
> unmarshaller:
>
> ObjectFactory objectFactory = new ObjectFactory();
> ConfigurationMatch configurationMatch =
> (ConfigurationMatch)objectFactory.newInstance(com.cisco.paws.ta.ConfigurationMatch.class);
>
> I then add the configurationMatch object to its
> parent's list (The parent can contain multiple
> configurationMatch elements)
>
> I am then marshalling the root when I get the
> following exception. Similarly, I get an exception if
> I try to unmarshal an invalid XML. Is this related to
> the bug you posted earlier. If so, when is a fix
> expected for this. Until then, do I have to manually
> create and set the mandatory children?

No, this is not related to the problem I mentioned.

Might help if you post your marshalling/unmarshalling code. Your stack
trace shows that you have not replaced the default validation handler:

> DefaultValidationEventHandler: [ERROR]: a required
> field "Name" is missing an ob
> ject
> Location: obj:
> com.cisco.paws.ta.impl.ConfigurationMatchImpl_at_1682a53
> Marshal Exception javax.xml.bind.ValidationException
> - with linked exception:
> [com.sun.xml.bind.serializer.AbortSerializationException:
> a required field "Name
> " is missing an object]

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