view m-toolbox/classes/+utils/@prog/obj2xml.m @ 52:daf4eab1a51e database-connection-manager tip

Fix. Default password should be [] not an empty string
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 07 Dec 2011 17:29:47 +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