This week's book giveaway is in the Artificial Intelligence and Machine Learning forum.
We're giving away four copies of Transfer Learning for Natural Language Processing (MEAP) and have Paul Azunre on-line!
See this thread for details.
Win a copy of Transfer Learning for Natural Language Processing (MEAP) this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

Castor help : matching another webservice

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,
How can I replicate the xml output to be like this:

<GetSalesResponse>
<GetSalesReturn>
<company status="ok">
<sales>
<sale>
<SaleID>xxxxx</SaleID>
<SaleDate>2008-08-07 10:11:12.0</SaleDate>
<SaleValue>1.00</SaleValue>
</sale>
</sales>
</company>
<GetSalesReturn>
</GetSalesResponse>


Given the following definition in mapping.xml:
..........
<class name="com.xxx.GetSalesResponse">
<map-to xml="company" />
<field name="status" type="java.lang.String">
<bind-xml name="status" node="attribute" />
</field>

<field name="sales"
collection="arraylist"
type="com.xxx.Sale" container="false">
<bind-xml name="sales" node="element"/>
</field>
</class>

<class name="com.xxx.Sale">
<map-to xml="sale" />
<field name="saleId" type="string">
<bind-xml name="saleId" node="element" />
</field>
<field name="saleDate" type="string">
<bind-xml name="saleDate" node="element" />
</field>
<field name="saleValue" type="string">
<bind-xml name="saleValue" node="element" />
</field>
</class>
...............

This structure currently gives something like the following:

<company status="ok">
<sales>
<sale>
<SaleID>xxxxx</SaleID>
<SaleDate>2008-08-07 10:11:12.0</SaleDate>
<SaleValue>1.00</SaleValue>
</sale>
</sales>
</company>


I am looking to replace a legacy web service so the design
is out of my hands.

Kind regards,

Mark
 
Mark Dathorne
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Done ...

<class name="com.xxx.GetSalesResponse">
<map-to xml="GetSalesResponse" />
<field name="status" type="java.lang.String">
<bind-xml name="status" node="attribute" location="GetSalesResponse/GetSalesReturn/company" />
</field>

<field name="sales"
collection="arraylist"
type="com.xxx.Sale">
<bind-xml name="sale" node="element" location="GetSalesResponse/GetSalesReturn/company/sales"/>
</field>
</class>
[ August 21, 2008: Message edited by: Mark Dathorne ]
 
Dinner will be steamed monkey heads with a side of tiny ads.
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic