I am trying to unmarshall the following xml ( I have left out the
attributes):

<?xml version="1.0" encoding="UTF-8" ?>
  <FOOROOT>
    <BAR >
        <BARINFO />
        <BARHISTORY>
            <BARDATA />
             <BARDATA />
        <BARHISTORY >
    </BAR>
  </FOOROOT>

to create an object Bar that contains a collection of histories and a
barInformation:

    public class Bar {
        (collection) get/setBarHistories
        get/setBarInformation
    }

I have defined my mapping as such:

<mapping>
 <class name="com.Bar">
  <map-to xml="FOOROOT"/>

  <field name="BarHistories" type="com.BarHistory"
collection="collection">
   <bind-xml name="BARDATA" node="element" location="BAR/BARHISTORY"/>
  </field>

  <field name="BarInformation" type="com.BarInformation">
   <bind-xml name="BARINFO" node="element" location="BAR"/>
  </field>
 </class>

<class name="com.BarInformation">
  // fields go here
 </class>

<class name="com.BarHistory">
  // fields go here
 </class>

</mapping>

--------------------------------------------------------
Now - I keep getting an exception when unmarshalling:

   [junit] com/BAR (wrong name: com/Bar)
   [junit] java.lang.NoClassDefFoundError: com/BAR (wrong name: com/Bar)

   [junit]     at java.lang.ClassLoader.defineClass0(Native Method)

Having played around I noticed that if I change my xml so that the <BAR>

element is named something different than its corresponding class like
BARX, and likewise change the location in the mapping to reference BARX
all works fine.

Note: I have no control over the xml so I can not change the root to be
BAR.

Just wondering if I am missing something obvious before I start looking
at the src.

Thanks - Jurek
===========================================================================

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to