When I use "element" as node type it works as expected (just one surrounding
tag),
<ATLs>
 <Washing>
  <OnAdmission>5</OnAdmission>
  <OnSeparation>15</OnSeparation>
 </Washing>
 <Dressing>
  <OnAdmission>5</OnAdmission>
  <OnSeparation>15</OnSeparation>
 </Dressing>
 <Eating>
  <OnAdmission>5</OnAdmission>
  <OnSeparation>15</OnSeparation>
 </Eating>
</ATLs>
 but I need exactly this behavior with the node type "attribute".
I need an output like that:
<ATLs>
 <Washing OnAdmission="5" OnSeparation="15"/>
 <Dressing OnAdmission="5" OnSeparation="15"/>
 <Eating OnAdmission="5" OnSeparation="15"/>
</ATLs>

Thanks for your time on that.



Werner Guttmann wrote:
> 
> Just out of curiosty, what happens when you change the node type for
> these Java properties to be 'element' rather than 'attribute' ?
> 
> Werner
> 
> SantiagoA wrote:
>> Hi again,
>> 
>> in my java-class i have that:
>>      private String washingAdm = "";
>>      private String washingSep = "";
>>      private String dressingAdm = "";
>>      private String dressingSep = "";
>>      private String eatingAdm = "";
>>      private String eatingSep = "";
>> and the getters and setters for that.
>> The "ATLs" is not a class or a nested class, but i need to have it in the
>> xml-structure.
>> The example with the "location" attribute you show me says something like
>> that:
>> "To use more than one wrapper element, the name is separated by a
>> forward-slash as such:
>> <bind-xml name="bar" location="abc/xyz" />"
>> That´s what I want, but why does the first wrapper element show up for
>> every
>> "nested" tag and not for all nested ones in just one wrapping element?
>> 
>> 
>> 
>> Lukas Lang wrote:
>>> Hello,
>>>
>>> this is not a bug, as the location attribute is
>>>
>>>   "...always relative to the class in which the field is being defined."
>>> [1]
>>>
>>> Using:
>>>
>>> <mapping>
>>>     <class name="xml.template.Atls">
>>>             <map-to xml="ATLs" />
>>>             <field name="washingAdm" type="string">
>>>                     <bind-xml name="OnAdmission" node="attribute"
>>>                             location="Washing" />
>>>             </field>
>>>             <field name="washingSep" type="string">
>>>                     <bind-xml name="OnSeparation" node="attribute"
>>>                             location="Washing" />
>>>             </field>
>>>             <field name="dressingAdm" type="string">
>>>                     <bind-xml name="OnAdmission" node="attribute"
>>>                             location="Dressing" />
>>>             </field>
>>>             <field name="dressingSep" type="string">
>>>                     <bind-xml name="OnSeparation" node="attribute"
>>>                             location="Dressing" />
>>>             </field>
>>>             <field name="eatingAdm" type="string">
>>>                     <bind-xml name="OnAdmission" node="attribute"
>>>                             location="Eating" />
>>>             </field>
>>>             <field name="eatingSep" type="string">
>>>                     <bind-xml name="OnSeparation" node="attribute"
>>>                             location="Eating" />
>>>             </field>
>>>     </class>
>>> </mapping>
>>>
>>> will generate your desired xml. For detailed information, have a look at
>>> the mapping documentation [1].
>>>
>>> Regards,
>>> Lukas
>>>
>>> [1] http://www.castor.org/xml-mapping.html#6.-Location-attribute
>>>
>>> SantiagoA schrieb:
>>>> Hi there,
>>>> I´ve problem with the generated Tags.
>>>>
>>>> in my mapping file i have something like this:
>>>> <field name="washingAdm" type="string">
>>>>  <bind-xml name="OnAdmission" node="attribute"
>>>> location="ATLs/Washing"/>
>>>> </field>
>>>> <field name="washingSep" type="string">
>>>>  <bind-xml name="OnSeparation" node="attribute"
>>>> location="ATLs/Washing"/>
>>>> </field>
>>>> <field name="dressingAdm" type="string">
>>>>  <bind-xml name="OnAdmission" node="attribute"
>>>> location="ATLs/Dressing"/>
>>>> </field>
>>>> <field name="dressingSep" type="string">
>>>>  <bind-xml name="OnSeparation" node="attribute"
>>>> location="ATLs/Dressing"/>
>>>> </field>
>>>> <field name="eatingAdm" type="string">
>>>>  <bind-xml name="OnAdmission" node="attribute" location="ATLs/Eating"/>
>>>> </field>
>>>> <field name="eatingSep" type="string">
>>>>  <bind-xml name="OnSeparation" node="attribute"
>>>> location="ATLs/Eating"/>
>>>> </field>
>>>>
>>>> The generated output looks like that:
>>>> <ATLs>
>>>>  <Washing OnAdmission="5" OnSeparation="15"/>
>>>> </ATLs>
>>>> <ATLs>
>>>>  <Dressing OnAdmission="5" OnSeparation="15"/>
>>>> </ATLs>
>>>> <ATLs>
>>>>  <Eating OnAdmission="5" OnSeparation="15"/>
>>>> </ATLs>
>>>>
>>>> Is this a bug or do I something wrong?
>>>> I expected the Washing-, Dressing-, Eating-Tags to be surrounded by
>>>> just
>>>> one
>>>> ATL-Tag.
>>>> I´m new to Castor, so any help would be highly apreciated.
>>>
>>> ---------------------------------------------------------------------
>>> 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/Generated-XML-Tags-via-mapping-file-are-wrong-tp19250873p19266730.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