Hello,

 

I am pretty new to Jibx.  I have been trying to test it out to see how
useful it would be in our project.  It looks promising, but I am having
some mapping problems.  I would like to see if anybody else has had a
similar situation and how they handled it. 

 

The XML file that I am mapping (simplified):

 

<Customer> 

  <Name />

  <Addresses>

    <Address>

      <Street>Address 1</Street>    

    </Address>

    <Address>

      <Street>Address 1</Street>

    </Address>

  </Addresses>

</Customer>

 

The simplified class structure that I am trying to map to is
(simplified):

 

public interface Customer {

 

  public String getName();

  public void setName(String name);

 

  public ArrayList<Address> getAddresses();

  public void setAddresses(ArrayList<Address> addressList);

}

 

public class CustomerImpl implements Customer {

 

  private String customerName;

  private ArrayList<Address> addresses;

 

  public String getName(){return customerName;}

  public void setName(String name){customerName=name;}

 

  public ArrayList<Address> getAddresses(){return addresses;}

  public void setAddresses(AddressList<Address> addressList){addresses =
addressList;}

}

 

public interface Address {

  public String getStreet();

  public void setStreet(String street);

}

 

public class AddressImpl implements Address {

  private String street;

 

  public String getStreet() {...}

  public void setStreet(String street){...}

}

 

 

I have been trying to map these together, but I keep getting to dead
ends.  I have made a lot of progress, but the biggest problems I face
are using the Interfaces, and getting the collection to map to the
address.  

 

Does anybody have an example of how this would be mapped?

 

 

As a side note the Address class is used in several places, it is a
child to other elements, and sometimes used  independently.  I wanted to
see if you could do a reference type of thing when creating the mapping
so that I can tell the Customer mapping to map the Address field using
the Address mapping defined elsewhere in the binding definition.

 

 

Thank you for your help.  

 

Keith

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
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

Reply via email to