view m-toolbox/classes/@param/fromDom.m @ 39:11e3ed9d2115
database-connection-manager
Implement databases listing in database connection dialog
author
Daniele Nicolodi <nicolodi@science.unitn.it>
date
Mon, 05 Dec 2011 16:20:06 +0100 (2011-12-05)
parents
f0afece42f48
children
line source
+ −
+ − function obj = fromDom(obj, node, inhists)
+ −
+ − % Get shape
+ − objShape = utils.xml.getShape(node);
+ − type = utils.xml.mchar(node.getAttribute('type'));
+ −
+ − if any(objShape==0) && isempty(type)
+ −
+ − obj = param.initObjectWithSize(objShape(1), objShape(2));
+ −
+ − else
+ −
+ − %%%%%%%%%% Call super-class
+ −
+ − fromDom@ltpda_nuo(obj, node, inhists);
+ −
+ − %%%%%%%%%% Get properties from the node attributes
+ −
+ − % Get key
+ − obj.key = utils.xml.mchar(node.getAttribute('key'));
+ −
+ − % Get desc
+ − obj.desc = utils.xml.mchar(node.getAttribute('desc'));
+ −
+ − % Get value
+ − if node.hasAttribute('type')
+ − % till LTPDA version 2.3.1
+ − obj.setVal(utils.xml.getFromType(node, inhists));
+ − else
+ −
+ − %%%%%%%%%% Get properties from the child nodes
+ − % since LTPDA version 2.3.2
+ −
+ − % Get val
+ − childNode = utils.xml.getChildByName(node, 'val');
+ − if ~isempty(childNode)
+ − obj.setVal(utils.xml.getFromType(childNode, inhists));
+ − end
+ −
+ − % Get properties
+ − childNode = utils.xml.getChildByName(node, 'properties');
+ − if ~isempty(childNode)
+ − prop = utils.xml.getStruct(childNode, inhists);
+ − fn = fieldnames(prop);
+ − for pp = 1:numel(fn)
+ − obj.setProperty(fn{pp}, prop.(fn{pp}));
+ − end
+ − end
+ − end
+ −
+ − end
+ −
+ − end