If you're using multiple bindings for unmarshalling you first need to 
determine the appropriate binding to be used for a particular document. 
There are ways of doing this at runtime based on the actual content 
(such as an attribute of the root element - see 
http://jibx.sourceforge.net/tutorial/binding-custom.html#frontend for 
code to do this).

If you just want to allow different root elements for a document, that's 
a simpler case - you just include <mapping> definitions for all the 
possible root elements in a single binding, then JiBX uses whichever one 
is appropriate for the actual root element of the supplied document.

You only need to call the getFactory method when you're looking up a 
particular binding. If there's only one binding you can just use the 
returned IBindingFactory over and over; if there are multiple bindings, 
you can either look up the binding factory for a binding each time you 
use it, or just cache the factory for each binding you're using.

  - Dennis

Dennis M. Sosnoski
SOA and Web Services in Java
Training and Consulting
http://www.sosnoski.com - http://www.sosnoski.co.nz
Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117



[EMAIL PROTECTED] wrote:
> Hi All,
>  
> I was after some advice on creating a generic marshaller/unmarshaller 
> using Jibx and specifically the BindFactory
>  
> Marshalling is fine as in this case I can take the passed in Object 
> and call getClass() for the BindFactory i.e
>  
> IBindingFactory fact = BindingDirectory. getFactory(obj.getClass());
>  
> For UnMarshalling, I don't know what the xml contains to know what 
> Object Model to create from it. For the different object models, there 
> is going to be a different bind file. Can multiple classes be registered?
>  
> Also Each time I want to marshal/unmarshal, do I need to do a 
> BindingDirectory. getFactory?
>  
> Any advice is welcome
>  
> Regards,

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to