hi all,

I am using castor and a simple mapping file  to generate some XML ...

<ParentNode>
   <strA>apple</strA>
   <ChildNode>
      <strC>carrot</strC>
   </ChildNode>
   <strD>dim-sum</strD>
</ParentNode>

but we need XML like this ... 

<ParentNode>
   <strA>apple</strA>
   <strC>carrot</strC>
   <strD>dim-sum</strD>
</ParentNode> 

to be produced.

The mapping I am using is

    <class name="me.castordemo.ParentNode">
        <map-to xml="ParentNode" />
  
        <field name="strA" type="string">
            <bind-xml name="strA"/>
        </field>
  
        <field name="nodeC" type="me.castordemo.ChildNode">
            <bind-xml name="ChildNode"/>
        </field>
  
        <field name="strD" type="string">
            <bind-xml name="strD"/>
        </field>
    </class>
 
    <class name="me.castordemo.ChildNode">
        <map-to xml="ChildNode" />

        <field name="strC" type="string">
            <bind-xml name="strC"/>
        </field>  

    </class>

The castor docs seem to suggest using the location parameter to do this "This 
is useful for "wrapping" values in elements or for mapping values that appear 
on sub-elements to the current "element" represented by the class mapping."

When I set

    <bind-xml name="strC" location="ParentNode"/>

the output xml was 

<ParentNode>
   <strA>apple</strA>
   <ChildNode>
      <ParentNode>
          <strC>carrot</strC>
      </ParentNode>
   </ChildNode>
   <strD>dim-sum</strD>
</ParentNode>

Can anyone suggest a fix?

This is driving me bonkers, so any help greatly appreciated! Many thanks ...

Paul

Aviva Group Ireland plc. Registered in Ireland No 113223. Registered Office One 
Park Place, Hatch Street, Dublin 2.

Aviva Insurance Limited, trading as Aviva, is authorised by the Prudential 
Regulation Authority in the UK and is regulated by the Central Bank of Ireland 
for conduct of business rules.

Registered Branch Office in Ireland No 900175, Registered Branch Address One 
Park Place, Hatch Street, Dublin 2. Registered in Scotland No 2116. Registered 
Office Pitheavlis, Perth, PH2 0NH.

Aviva Direct Ireland Limited is regulated by the Central Bank Of Ireland. A 
private company limited by shares. Registered in Ireland No 374895. Registered 
Office One Park Place, Hatch Street, Dublin 2.

Aviva Life & Pensions Ireland Limited is regulated by the Central Bank Of 
Ireland. A private company limited by shares. Registered in Ireland No 252737. 
Registered Office One Park Place, Hatch Street, Dublin 2.

Aviva Life Services Ireland Limited is regulated by the Central Bank Of 
Ireland. A private company limited by shares. Registered in Ireland No 406616. 
Registered Office One Park Place, Hatch Street, Dublin 2.

Aviva Health Insurance Ireland Limited is regulated by the Central Bank Of 
Ireland. A private company limited by shares. Registered in Ireland No 376607. 
Registered Office One Park Place, Hatch Street, Dublin 2.

www.aviva.ie

The information transmitted is intended only for the person or entity to which 
it is addressed and may contain confidential and/or privileged material. Any 
review, retransmission, dissemination or other use of, or taking of any action 
or reliance upon this information by persons or entities other than the 
intended recipient is prohibited. If you received this in error, please contact 
the sender and delete the material from your computer.

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

    http://xircles.codehaus.org/manage_email


Reply via email to