My generic class is MessageDetail.

now i want to map all the elements namely product, articlenumber ,
redemptiontype... etc  should be mapped with that generic MessageDetail java
class. i dont know how to give that mapping

i have attached both the mapping xml &  the input xml

please help me

thanks in advance
<?xml version="1.0"?>
<loy:createproducts >
        <loy:productDef>
                <loy:product name = "Shiptest" >
                        <loy:articlenumber name = "PRD2003" />
                        <loy:redemptiontype description = "B" />
                        <loy:category code = "CAT2" />
                        <loy:price
                                retailprice = "55555"
                                specialprice = ""
                                releasedate = "22/Mar/2006"
                        />
                        <loy:productdescription value = "prd des" />


                        <loy:auctionattributes
                                minimummerchantprice = "1"
                                standardbrokermargin = "1"
                                minimumbrokermargin = "1"
                                releasedate = "22/Mar/2006"
                                closingdate = "22/Mar/2006"
                                auctionduration = "1"
                                maxquantityperauction = "1"
                        />
                </loy:product>
        </loy:productDef>

</loy:createproducts>

-----------------------------

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

  <class name="test.Message" >
     <map-to xml="productDef"/>
     <field name="messageDetails" direct="false" transient="false"
type="test.MessageDetail" collection="arraylist">
        <bind-xml name="product"/>
     </field>

  </class>

  <class name="test.MessageDetail" >

     <map-to xml="product"/>
     <field name="key" direct="false" transient="false"
type="java.lang.String">
        <bind-xml name="key" node="attribute"/>
     </field>
         <field name="value" direct="false" transient="false"
type="java.lang.String">
                <bind-xml name="name" node="attribute"/>
     </field>
     
         <field name="value" direct="false" transient="false"
type="java.lang.String">
                <bind-xml name="name" node="attribute"/>
     </field>
  </class>

</mapping>


Werner Guttmann wrote:
> 
> So where did you get stuck, if I may ask ? Why not provide us with some
> samples, as we'll have a look together.
> 
> Werner
> 
> Logu... wrote:
>> Sorry, Actually i tried mapping but i got stuck.
>> 
>> My issue was not how to mapp different XML elements to an same Generic
>> object sir!
>> i tried googling.. i couldnt find any help.
>> 
>> 
>> Werner Guttmann wrote:
>>> How about reading the section about the castor mapping first, try a few
>>> things, and if there's some outstanding questions, come back here and
>>> ask
>>> ?
>>>
>>> Werner
>>>
>>> Logu... wrote:
>>>> Ya i too thought of that. 
>>>> My doubt is how to write a mapping file for the given XML structure &
>>>> the
>>>> Java Classes..
>>>>
>>>> Idea is to map every xml element to the the generic object called
>>>> MessageDetail class.
>>>> Root tag needs to be repersented by Message class. The stucture of them
>>>> is
>>>> given below.. 
>>>>
>>>> Please help to create an mapping file
>>>>
>>>>
>>>>
>>>> Werner Guttmann wrote:
>>>>> How about writing a mapping file that maps the individual XML
>>>>> artefacts
>>>>> to your Java classes/member variables ?
>>>>>
>>>>> Werner
>>>>>
>>>>> Logu... wrote:
>>>>>> I have two Java classes.. namely
>>>>>> 1) Mesasge 
>>>>>> 2) MessageDetail
>>>>>>
>>>>>> Structure
>>>>>>
>>>>>> public class Message {
>>>>>>  private List<MessageDetails> messageDetails;
>>>>>>  ........ //Setters & getters
>>>>>> }
>>>>>>
>>>>>> public class MessageDetails{
>>>>>>  private String key;
>>>>>>  private String value;
>>>>>>  private List<MessageDetails> children;
>>>>>>  ........ //Setters & getters
>>>>>> }
>>>>>>
>>>>>>
>>>>>> The requirement is when i recieve an xml like below i need to create
>>>>>> object
>>>>>> as above.
>>>>>> Please help me to create mapping file.. am new to castor
>>>>>>
>>>>>> <?xml version="1.0"?>
>>>>>> <loy:createproducts >
>>>>>>  <loy:productDef>
>>>>>>          <loy:product name = "Shiptest" >
>>>>>>                  <loy:articlenumber name = "PRD2003" />
>>>>>>                  <loy:redemptiontype description = "B" />
>>>>>>                  <loy:category code = "CAT2" />
>>>>>>                  <loy:price
>>>>>>                          retailprice = "55555"
>>>>>>                          specialprice = ""
>>>>>>                          releasedate = "22/Mar/2006"
>>>>>>                  />
>>>>>>                  <loy:productdescription value = "prd des" />
>>>>>>
>>>>>>
>>>>>>                  <loy:auctionattributes
>>>>>>                          minimummerchantprice = "1"
>>>>>>                          standardbrokermargin = "1"
>>>>>>                          minimumbrokermargin = "1"
>>>>>>                          releasedate = "22/Mar/2006"
>>>>>>                          closingdate = "22/Mar/2006"
>>>>>>                          auctionduration = "1"
>>>>>>                          maxquantityperauction = "1"
>>>>>>                  />
>>>>>>          </loy:product>
>>>>>>  </loy:productDef>
>>>>>>
>>>>>> </loy:createproducts>
>>>>>>
>>>>>>
>>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe from this list, please visit:
>>>>>
>>>>>     http://xircles.codehaus.org/manage_email
>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>>     http://xircles.codehaus.org/manage_email
>>>
>>>
>>>
>>>
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
> 
>     http://xircles.codehaus.org/manage_email
> 
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/castor-mapping---Help-required-tp17267388p17357040.html
Sent from the Castor - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to