Monday, August 3, 2009

Easy way to Serialize and Deserialize Object to String XML

This is probably one of the most comonly asked questions for developers who just start off working with SOAP, Webservices, or cross platform communication through XML. The easiest way to convert an object to string XML and back is to use two functions similar to the ones bellow:



Here is a sample usage of the above two functions:



I hope it comes in handy for someone. Just don't forget to add error handling to the usage code, in case your XML string is not complete or corrupt.
Pete Soheil
DigiOz Multimedia
http://www.digioz.com/

No comments: