Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

xml vs DTO

 
ramesh kumaru
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Why is xml used to pass data between application layers? We can very well use DTO for same purpose.

Thanks
Ramesh
 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch, Ramesh!

As for your question: you would have to ask the person who decided to do it that way why they made that decision. It's possible that it was a good decision, or that it was a bad decision, but without any details it's useless to speculate about it.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13061
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My reasons for using XML instead of DTO etc

- easy to create/modify example data with a text editor so you can test data processing independently from data creation
... see for example the use of SOAPui to manipulate SOAP XML messages, especially for creating error conditions

- easy to read actual data transmissions - see SOAPui again

- easy to add new data elements without having to modify existing programming (assuming you chose a good structure in the first place.)

Bill
 
ramesh kumaru
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks William and Paul,

In my application they have DTO and in each DTO they have marshalXML and unMarshalXML method/function which are used for xml generation.

This xml is passed to different layers including DAO layer. I am fail to understand why this architecture, instead they can use DTO itself and avoid overhead of Marshalling XML and UN-Marshalling XML.

Can you please provide some pointers, How this architecture benefits.

Regards,
Ramesh
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic