Hi,

 

I am using Castor to marshall java objects into XML.  I have created the mapping file and am using the non-static marshall method to create my XML.

 

The problem I am having is that my generated xml contains lots of information which I don’t want within the XML.

 

My mapping file looks like this:

<?xml version="1.0" encoding="UTF-8"?>

<mapping>

    <class name="com.retailexp.amp.transferobjects.offer.type.Offer"

        extends="com.retailexp.amp.common.transferobjects.Resource">

        <description>Default mapping for class com.retailexp.amp.transferobjects.offer.type.Offer</description>

        <map-to xml="offer"/>

 

        <field name="resourceId" type="long" required="true"

            direct="false" transient="false">

            <bind-xml name="resource-id" node="attribute"/>

        </field>

 

        <field name="typeId" type="integer" required="true"

            direct="false" transient="false">

            <bind-xml name="type-id" node="attribute"/>

        </field>

 

        <field name="name" type="string" required="false" direct="false" transient="false">

            <bind-xml name="name" node="attribute"/>

        </field>

 

        <field name="startDate" type="date" required="true"

            direct="false" transient="false">

            <bind-xml name="start-date" node="element"/>

        </field>

 

         <field name="endDate" type="date" required="true" direct="false" transient="false">

            <bind-xml name="end-date" node="element"/>

        </field>

 

        <field name="offerLimit" type="integer" required="false"

            direct="false" transient="false">

            <bind-xml name="offer-limit" node="element"/>

        </field>

 

        <field name="labelTypeId" type="long" required="false"

            direct="false" transient="false">

            <bind-xml name="label-type-id" node="element"/>

        </field>

 

        <field name="program"

            type="com.retailexp.amp.transferobjects.PromotionalProgram"

            required="false" direct="false" transient="false"

            get-method="getProgram" set-method="setProgram">

            <bind-xml name="program" node="element"/>

        </field>

 

        <field name="reason"

            type="com.retailexp.amp.transferobjects.offer.ReasonCode"

            required="false" direct="false" transient="false">

            <bind-xml name="reason" node="element"/>

        </field>

 

        <field name="theme"

            type="com.retailexp.amp.transferobjects.offer.Theme"

            required="false" direct="false" transient="false">

            <bind-xml name="theme" node="element"/>

        </field>

        <field name="applicationMethod"

            type="com.retailexp.amp.transferobjects.offer.ApplicationMethod"

            required="false" direct="false" transient="false">

            <bind-xml name="application-method" node="element"/>

        </field>

    </class>

 

 

    <class name="com.retailexp.amp.transferobjects.PromotionalProgram" auto-complete="false">

        <description>Default mapping for class com.retailexp.amp.transferobjects.PromotionalProgram</description>

        <map-to xml="promotional-program"/>

        <field name="resourceId" type="long" required="true"

            direct="false" transient="false">

            <bind-xml name="resource-id" node="attribute"/>

        </field>

 

        <field name="typeId" type="integer" required="true"

            direct="false" transient="false">

            <bind-xml name="type-id" node="attribute"/>

        </field>

    </class>

 

 

    <class name="com.retailexp.amp.transferobjects.offer.ReasonCode" auto-complete="false">

        <description>Default mapping for class com.retailexp.amp.transferobjects.offer.ReasonCode</description>

        <map-to xml="reason-code"/>

        <field name="resourceId" type="long" required="true"

            direct="false" transient="false">

            <bind-xml name="resource-id" node="attribute"/>

        </field>

 

        <field name="typeId" type="integer" required="true"

            direct="false" transient="false">

            <bind-xml name="type-id" node="attribute"/>

        </field>

    </class>

 

    <class name="com.retailexp.amp.transferobjects.offer.Theme" auto-complete="false">

        <description>Default mapping for class com.retailexp.amp.transferobjects.offer.Theme</description>

        <map-to xml="theme"/>

        <field name="resourceId" type="long" required="true"

            direct="false" transient="false">

            <bind-xml name="resource-id" node="attribute"/>

        </field>

        <field name="typeId" type="integer" required="true"

            direct="false" transient="false">

            <bind-xml name="type-id" node="attribute"/>

        </field>

    </class>

 

    <class

        name="com.retailexp.amp.transferobjects.offer.ApplicationMethod" auto-complete="false">

        <description>Default mapping for class com.retailexp.amp.transferobjects.offer.ApplicationMethod</description>

        <map-to xml="application-method"/>

        <field name="resourceId" type="long" required="true"

            direct="false" transient="false">

            <bind-xml name="resource-id" node="attribute"/>

        </field>

        <field name="typeId" type="integer" required="true"

            direct="false" transient="false">

            <bind-xml name="type-id" node="attribute"/>

        </field>

    </class>

 

</mapping>

 

The generated XML ( this is only a snippet because it is huge) looks like the following:

 

<points-redemption-price-offer type-id="44" resource-id="10001" skeleton="false" store-group-usage-iD="0" offer-limit="6" label-type-id

="1">

 

<program resource-id="300"/>

<start-date>2003-05-12T16:03:00.015+01:00</start-date>

 

<label-type type-id="34" resource-id="1">

<name>Standard</name>

<brief-description>Label Type Id: 1 Standard</brief-description></label-type>

 

As you can see In the root tag points-redemption-price-offer there are several attributes.  In my mapping file I have only assigned 3 attributes why does it add all these extra attributes to the XML.  It also adds lots of other stuff and I don’t understand why.  I have auto complete set to false so introspection should not be on.

 

Anyone help??

 

Thanks

Faisal

 

Reply via email to