Mercurial > hg > ltpda
view m-toolbox/classes/+utils/@prog/obj2xml.m @ 12:86aabb42dd84 database-connection-manager
Use utils.repository utilities
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Mon, 05 Dec 2011 16:20:06 +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