Mercurial > hg > ltpda
view m-toolbox/classes/+utils/@prog/obj2xml.m @ 51:9d5c88356247 database-connection-manager
Make unit tests database connection parameters configurable
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 07 Dec 2011 17:24:37 +0100 |
parents | f0afece42f48 |
children |
line wrap: on
line source
% OBJ2XML Converts an object to an XML representation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % DESCRIPTION: Converts an object to XML representation. % % CALL: xml = utils.prog.obj2xml(obj) % % INPUTS: obj - the object to be converted % % OUTPUTS: xml - the converted object % % EXAMPLE: % % VERSION: $Id: obj2xml.m,v 1.1 2010/05/17 08:55:25 nicolodi Exp $ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function str = obj2xml(obj) % make pointer to xml document xml = com.mathworks.xml.XMLUtils.createDocument('ltpda_object'); % extract parent node parent = xml.getDocumentElement; % add an 'ltpda_version' attribute to the root node ltpda_version = getappdata(0, 'ltpda_version'); parent.setAttribute('ltpda_version', ltpda_version); % write obj into xml utils.xml.xmlwrite(obj, xml, parent, ''); % convert into a string str = xmlwrite(xml); end