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
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to