This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes xml vs DTO Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "xml vs DTO" Watch "xml vs DTO" New topic
Author

xml vs DTO

ramesh kumaru
Greenhorn

Joined: Sep 30, 2012
Posts: 2
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
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

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

Joined: Mar 22, 2000
Posts: 12769
    
    5
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

Joined: Sep 30, 2012
Posts: 2
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: xml vs DTO