Hi
Thanks for your reply but I must admit the I do not comprehend what you
mean.
Jon
Varghese C V wrote:
> The BindingFactory need not be looked up every time.
> During the Xml Handler initialization look the binding factory once
> with a class that is part of the binding.
> Looking up a binding factory from any class that is part of the
> binding definition would return the same binding factory.
> The binding factory is threadsafe.
>
> Personally, I use spring to inject a binding factory lookup class to a
> xml handler.
>
> Hope this helps
> Varghese C V
>
> Jon Little wrote:
>> Hi
>>
>> I'm new to jibx but i love the concept.
>>
>> I'm planning on using jibx for the xml translator on struts.
>>
>> Each class will have a binding,
>>
>> The xml handler has two pre-defined methods - fromObject and toObject.
>>
>> The fromObject method is pretty straightforward (and I hope the
>> toObject will be too):
>> public String fromObject(Object obj, String resultCode, Writer out)
>> throws IOException
>> {
>> if (obj != null)
>> {
>> try
>> {
>> IBindingFactory bf =
>> BindingDirectory.getFactory(obj.getClass());
>> IMarshallingContext mc = bf.createMarshallingContext();
>> mc.marshalDocument(obj, null, null, out);
>> }
>> catch (JiBXException e)
>> {
>> // TODO Auto-generated catch block
>> e.printStackTrace();
>> }
>> }
>> return null;
>> }
>>
>> The toObject method has the following signature:
>>
>> public void toObject(Reader in, Object target)
>>
>> My question is given that each class will have it's own binding and I
>> don't know the class of the object that is about to be unmarshalled
>> how do I call BindingDirectory.getFactory to get the correct binding?
>>
>> Thinking you in advance.
>>
>> Jon
>>
>> -------------------------------------------------------------------------
>>
>> Check out the new SourceForge.net Marketplace.
>> It's the best place to buy or sell services for
>> just about anything Open Source.
>> http://sourceforge.net/services/buy/index.php
>> _______________________________________________
>> jibx-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/jibx-users
>>
>>
>
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
jibx-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users