This week's giveaway is in the Java in General forum.
We're giving away four copies of Java Challengers and have Rafael del Nero on-line!
See this thread for details.
Win a copy of Java Challengers this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

JavaBean population from XML

Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to populate a JavaBean from a XML file. (Not using any XMLBEAN from Apache !!)


Two Beans:
public class Company implements Serializable {

protected PersonName[] names;
protected int ecode;

... //Getter and setter methods not posted here..
public class PersonName implements Serializable {

protected String _firstName;

.. // getter and setters not posted here

I'm able to populate simple types like String for one bean.

But when i try to popluate a array of JavaBeans (PersonName)inside another
Bean (Company) using

Method imeth= ipd.getIndexedWriteMethod();

//ipd is the IndexedPropertyDescriptor of Bean Company
// jb -> the Company JavaBean already initialized and populated with 'id'.
// finalArgs -> Object[] finalArgs = new Object[] {new Integer(i),jbs[i]};
// Where jbs[i] is a PersonName Bean initialized with firstName


I get java.lang.reflect.InvocationTargetException when i try to insert PersonName bean (jbs[i]) inside the Company Bean (jb).

Any pointers as how this can be accompished is welcome.


PS: I do not want to use an ThirdParty Jar to accompish this like what BEA has.
Can you smell this for me? I think this tiny ad smells like blueberry pie!
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic