i did try this out. Seems rather not possible unless ofcourse you write your 
own field descriptor. 
The problem is in Castor one field element(bind-xml element) maps to one 
element in the output xml. so when u put 2 field elements it maps to 2 elements
you would be better off by changing output xml to something like this:
  <?xml version="1.0" encoding="UTF-8" ?> 
  <contentGroup id="AAA">
  <entryTemplate name="DDD" id="ddd" /> 
  </contentGroup>
unless some guys in the group have some other options.

Would like to know if they have a solution other than writing a field 
decsriptor class.



Quoting Anna Kerekes <[EMAIL PROTECTED]>:

> 
> Hello,
> 
> I need some help mapping the following xml sample:
> 
> <contentGroup id="1">
> 
> <entryTemplate id="1">Test</entryTemplate>
> 
> </contentGroup>
> 
> I want to do it in the following way, by creating only one class.
> However it does not work, why not?
> 
> <?xml version="1.0"?>
> 
> <!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Object Mapping DTD Version
> 1.0//EN" 
> 
> "C:/COTWorkspace2/ewwcms_web/Web Content/config/mapping.dtd">
> 
> <mapping>
> 
> <description>ContentGroupDetailsTO mapping file</description>
> 
>  
> 
> <class
> name="com.cot.ewwcms.domain.transferobject.RequestInputProperties"
> auto-complete="false">
> 
> <map-to xml="contentGroup" />
> 
> <field name="id" direct="true" type="string" required="true">
> 
> <bind-xml name="id" node="attribute" />
> 
> </field>
> 
> <field name="entryTemplate" direct="true" type="string"
> required="true">
> 
> <bind-xml name="entryTemplate" node="element" />
> 
> </field>
> 
> <field name="entryTemplateId" direct="true" type="string"
> required="true">
> 
> <bind-xml name="id" location="entryTemplate" node="attribute" />
> 
> </field>
> 
> </class>
> 
>  
> 
> </mapping>
> 
> This solution, on the other hand, works. However, it 
> 
> Requires me to create more classes, which I don't want:
> 
> <?xml version="1.0"?>
> 
> <!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Object Mapping DTD Version
> 1.0//EN" 
> 
> "C:/COTWorkspace2/ewwcms_web/Web Content/config/mapping.dtd">
> 
> <mapping>
> 
> <description>ContentGroupDetailsTO mapping file</description>
> 
>  
> 
> <class
> name="com.cot.ewwcms.domain.transferobject.RequestInputProperties"
> auto-complete="false">
> 
> <map-to xml="contentGroup" />
> 
> <field name="id" direct="true" type="string" required="true">
> 
> <bind-xml name="id" node="attribute" />
> 
> </field>
> 
> <field name="entryTemplate" direct="true"
> type="com.cot.ewwcms.domain.transferobject.RequestInputTemplate"
> required="true">
> 
> <bind-xml name="entryTemplate" />
> 
> </field>
> 
> </class>
> 
> <class
> name=""com.cot.ewwcms.domain.transferobject.RequestInputTemplate">
> 
> <field name="entryTemplateId" direct="true" type="string"
> required="true">
> 
> <bind-xml name="id" node="attribute" />
> 
> </field>
> 
> <field name="entryTemplate" direct="true" type="string"
> required="true">
> 
> <bind-xml node="text" />
> 
> </field>
> 
> </class>
> 
>  
> 
> </mapping>
> 
>  
> 
> Please advise me how I can do the mapping by only using one class.
> 
> Thankyou, (email me back directly)
> 
> Anna Kerekes
> 
> ----------------------------------------------------------- 
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>         unsubscribe castor-dev
> 
> 

______________________________________________________________________________
This e-mail is intended only for the use of individual(s) named above. If you 
are not the intended recipient of this email, or employee or agent responsible 
for delivering it to the intended recipient, you are hereby notified that any 
dissemination or copying of this e-mail is strictly prohibitted. If you have 
received this e-mail in error, immediately notify us by e-mail at : 
[EMAIL PROTECTED]

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

Reply via email to