users@jaxb.java.net

Re: Validator throws error for non-mandatory fields

From: Ryan Shoemaker - JavaSoft East <Ryan.Shoemaker_at_Sun.COM>
Date: Tue, 12 Oct 2004 10:40:48 -0400

Roshan Nair wrote:
> Hi,
> I am working on the UBL sample provided with jaxb (jwsdp
> 1.4). I used JAXB to create the order form. There are only four
> elements that are always required (ie minOccurs="1"). These are ID,
> IssueDate, BuyerParty, SellerParty.
>
> I created an Order object with only these four elements.
> However when validating I get the following error:
>
> [java] DefaultValidationEventHandler: [ERROR]: uncompleted content
> model. expecting:
> <AllowanceCharge>,<DeliveryTerms>,<DestinationCountry>,<FreightForwarderParty>,<OrderLine>,<SalesConditions>,
> <org.oasis.ubl.commonaggregatetypes.AllowanceCharge>,<org.oasis.ubl.commonaggregatetypes.DeliveryTerms>,
> <org.oasis.ubl.commonaggregatetypes.DestinationCountry>,<org.oasis.ubl.commonaggregatetypes.FreightForwarderParty>,
> <org.oasis.ubl.commonaggregatetypes.OrderLine>,<org.oasis.ubl.commonaggregatetypes.SalesConditions>
> [java] Location: obj: org.oasis.ubl.order.impl.OrderImpl_at_f0c85e
> [java] There was a problem validating the order.
>
> Now, all these elements have a minOccurs="0". Why do I get this error?
> Where can I see a list of errors that ValidationEventHandler throws
> and their interpretations?
>

It's hard to say without looking at the code.

> The UBL schemas provided with the jwsdp1.4 distro are a subset of an
> older version of UBL.

JWSDP 1.4 shipped with a sample based on UBL 0p70. The upcoming
release of JWSDP 1.5 will ship with a sample based on UBL 1.0.
You can grab a preview release of jaxb[1] and try that instead.

> I am creating the Order object in a single
> class. I create instances of all the elements that are mandatory
> within the same class. I don't think the issue is with my code.
> Its fairly large so I'll post it if someone wants to look at it.

Assuming you didn't modify the binding customizations for the
schema, you can just send the client code that shows how you are
building and validating your content tree.

> A similar question (uncompleted content model) was asked earlier but
> the reply does not help here.
>

I think that thread was about unmarshalling incomplete XML, which
is a different beast altogether.

Thanks,

--Ryan

[1] https://jaxb.dev.java.net/servlets/ProjectDocumentList?folderID=460&expandFolder=460&folderID=0
     Grab the " JAXB_RI.class" file.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net