Hi All,
I'am a new bee to JibX. Could you please tell me how can i specify the binding 
for the following XML

<customer>
  <person>
    <cust-num>123456789</cust-num>
    <first-name>John</first-name>
    <last-name>Smith</last-name>
    <tech>Java</tech>
    <tech>XML</tech>
    <tech>EJB</tech>
    <tech>AJAX</tech>
  </person>
  <street>12345 Happy Lane</street>
  <city>Plunk</city>
  <state>WA</state>
  <zip>98059</zip>
  <phone>888.555.1234</phone>
</customer>



The classes i have is



package jibx;

public class Customer {
    public Person person;
    public String street;
    public String city;
    public String state;
    public Integer zip;
    public String phone;
}


ackage jibx;

import java.util.ArrayList;

public class Person {
    public int customerNumber;
    public String firstName;
    public String lastName;
    public ArrayList technologies;
    public String tech;
}

The main problem i have is to specify mapping for the tag "tech" to the 
"technologies" ArrayList in Person class.

I tried a binding like following 

<binding>
  <mapping name="customer" class="jibx.Customer">
    <structure name="person" field="person">
      <value name="cust-num" field="customerNumber"/>
      <value name="first-name" field="firstName"/>
      <value name="last-name" field="lastName"/>
      <collection field="technologies" name="tech" type="java.util.ArrayList" 
item-type="java.lang.String" /> 
    </structure>
    <value name="street" field="street"/>
    <value name="city" field="city"/>
    <value name="state" field="state"/>
    <value name="zip" field="zip"/>
    <value name="phone" field="phone"/>
  </mapping>
</binding>

but this throws a runtime exception   "Expected "person" end tag, found "tech" 
start tag" 

Please help. I'am trying this as a POC for a much more complex XML whose 
structure cannot be changed.


-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to