Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JiBX Collection Problem

807605Aug 21 2007
Hi,

I'm using the JiBX to bind the xml with java objects. But it comes out an error after i added the collection in.
     [bind] Error: Nonstatic field person not found in class java.lang.Object; on structure element at (line 4, col 46, in jibx-collection/binding.xml)
     [bind] Warning: Property access attributes (field, get-method, set-method, test-method) ignored for collection item; on structure element at (line 4, col 46, in jibx-collection/binding.xml)
data.xml
<customer>
  <person>
    <cust-num>123456789</cust-num>
    <first-name>John</first-name>
    <last-name>Smith</last-name>
  </person>
  <person>
    <cust-num>123456789</cust-num>
    <first-name>John</first-name>
    <last-name>Smith</last-name>
  </person>
</customer>
binding.xml
It comes out with same error even i changed the person to Person.
<binding>
  <mapping name="customer-profiles" class="org.jibx.starter.Customer">
  	<collection field="customers">
	    <structure name="person" field="person">
	      <value name="cust-num" field="customerNumber"/>
	      <value name="first-name" field="firstName"/>
	      <value name="last-name" field="lastName"/>
	    </structure>
    </collection>
  </mapping>
</binding>
Customer.java
package org.jibx.starter;
import java.util.ArrayList;
public class Customer {
   public ArrayList customers;
    public Person person;
}
Person.java
package org.jibx.starter;
public class Person {
    public int customerNumber;
    public String firstName;
    public String lastName;
}
Anyone have ideas on how to solve it? Your help will be much appreciates.
Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 18 2007
Added on Aug 21 2007
0 comments
404 views