I'm working with a XSD that defines ids on many of its elements as
optional. What is the best way to accomplish this in JiBX? I've tried a
mapping like this:
<mapping class="a.b.Class1" name="Class1">
<value name="id" field="id" style="attribute" usage="optional"
ident="def" />
</mapping>
When doing this, the binding compiler runs fine, but I get an exception at
runtime if the id attribute is not on the element in the instance document.
Is there a way within the normal binding to make an id optional?
The only option I can see is to write a custom marshaller/unmarshaller to
handle this. If I go that route, is there a good way to implement it
without having to write one for every element that has the optional id?
I've tried to use a base mapping with the custom marshalling, but Jibx
doesn't allow a mapping to be extended if it has the custom marshalling
attributes defined. The other way the documentation shows to do this is to
use a structure, but I can't see how to do this for just an attribute on the
containing mapping element.
Any ideas would be appreciated!
Zach
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users