I think what's going on is that Shawn expects the elements to be optional because he's using the default="" attribute on the definitions. The description of the default attribute says it can only be used on optional values. This is not actually enforced by the current code, but using the default attribute will not make the values optional - you still need the usage="optional" as Cameron said.

I'm hoping to clean up the enforcement of attribute usage constraints in beta 4 to catch this type of error. I know it's frustrating now when it looks like something is accepted by the binding compiler but it doesn't do what you expect in operation. I'll also see if I can make sure the expected element/attribute name is always included in the exception message.

- Dennis

Cameron Taggart wrote:

That is a pretty normal error when your XML document doesn't match the mapping binding document. It is too bad the JiBXException doesn't say expected "ownerId" start tag, but I think that is what it means in this case. You might want to make all the other values optional and see what you get. http://jibx.sourceforge.net/binding-attributes.html By default they are required.

<value name="ownerId" field="ownerId" default="" usage="optional"/>

Cameron



I am getting the above error when I try to unmarshall the following string: "<reminder objectType="reminder" content="keysOnly"><primaryId>339961</primaryId></reminder>"



The binding xml looks like this:

<mapping name="reminder" class="com.zones.sid.biz.customer.impl.ReminderImpl">

<value name="primaryId" field="primaryId" default=""/>

<value name="ownerId" field="ownerId" default=""/>

<value name="ownerType" field="ownerType" default=""/>

<value name="userId" field="userId" default=""/>

<value name="message" field="message" default=""/>

<value name="dueBy" field="dueBy" default=""/>

<value name="recurType" field="recurType" default=""/>

<value name="recurInterval" field="recurInterval" default=""/>

<value name="alarmActive" field="alarmActive" default=""/>

<value name="insertBy" field="insertBy" default=""/>

<value name="insertDate" field="insertDate" default=""/>

</mapping>



I have verified that the object contains the primaryId field and using the 'default=""' option is working for us in other locations for instances where all of the fields aren't getting returned via XML. At this point I don't know where else to look. Any help would be appreciated.






------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ jibx-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jibx-users




-- Dennis M. Sosnoski Enterprise Java, XML, and Web Services Training and Consulting http://www.sosnoski.com Redmond, WA 425.885.7197




------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ jibx-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to