I was able to successfully do the binding with castor-0.9.5.3 for the
following bind rule.

<mapping xmlns="http://castor.exolab.org/";
xmlns:cst="http://castor.exolab.org/";>
        <description>Castor generated mapping file</description>
        <class cst:name="DBModel">
                <description>Default mapping for class
DBModel</description>
                <map-to cst:xml="DBModel"/>
                <field cst:name="name" cst:type="java.lang.String">
                        <bind-xml name="name" node="attribute"/>
                </field>
                <field cst:name="type" cst:type="java.lang.String">
                        <bind-xml name="type" node="attribute"/>
                </field>
                <field cst:name="DBTables" cst:type="java.lang.Object"
cst:collection="map">
                        <bind-xml name="DBTable" node="element"/>
                </field>
                
        </class>
        <class cst:name="DBTable">
                <description>Default mapping for class
DBTable</description>
                <map-to cst:xml="DBTable"/>
                <field cst:name="name" cst:type="java.lang.String">
                        <bind-xml name="name" node="attribute"/>
                </field>
                <field cst:name="DBColumns" cst:type="java.lang.Object"
cst:collection="map">
                        <bind-xml name="DBColumn" node="element"/>
                </field>
                <field cst:name="attributes" cst:type="java.lang.Object"
cst:collection="map">
                        <bind-xml name="prop" node="element"/>
                </field>
        </class>
</mapping>
But with an older version I get following exception

org.exolab.castor.mapping.MappingException: Nested error:
org.xml.sax.SAXException: unable to find FieldDescriptor for 'class' in
ClassDescriptor of bind-xml

Is there something am missing with older versions. Since ours is a
integration suite, pretty hard to use multiple versions of the castor
library. Can any one shed some light on this ?

Thanks
Sudhi

-----Original Message-----
From: Keith Visco [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 18, 2004 1:11 AM
To: [EMAIL PROTECTED]
Subject: Re: [castor-user] Binding an element to nothing



Hi Michael,

Try the following:

unmarshaller.setIgnoreExtraElements(true);

--Keith


Michael Goodwin wrote:
> 
> Hi, I haven't been able to work out how to do this. If I want to drop
a
> field from my Java class, but already have marshalled xml versions of
it,
> with this field present. How can I read all the other data in,
ignoring
> this one field as the new class. If I could bind it to 'nothing' then
this
> would work. For me the advantage of Castor over straight serialisation
is
> that the data shouldn't become unreadable if modifications are made to
the
> classes (although certainly you can add fields).
> 
> thanks, Mike.
> 
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>         unsubscribe castor-user



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

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

Reply via email to