users@jaxb.java.net

Re: Possible bug in RI

From: Craig Raw <craig_at_quirk.co.za>
Date: Mon, 14 Apr 2003 22:26:01 +0200

> It looks like you are adding elements to the children of
> DataPointer, NOT DataPointer where they belong.
>
> >> pointer.add(fieldRef);
>
> hope this helps.
> ilya
>

The generated interface for DataPointer is as follows:

public interface DataPointer
{
    int getId();

    void setId(int value);

    java.lang.String getType();

    void setType(java.lang.String value);

    java.util.List getCategoryRefOrFieldRef();

...

Thus it impossible to add elements to DataPointer itself as you suggest.
The List accessed by calling getCategoryRefOrFieldRef() returns the
repeating choice correctly if valid XML is unmarshalled into the binding
tree. However, a DataPointer created by an ObjectFactory and marshalled
out is represented by the invalid XML described earlier. It is also true
that a JAXB binding tree should not generate XML that does not validate
against the same schema that it was generated from, as is the case here.

Regards,
Craig