view m-toolbox/classes/@plist/fromDom.m @ 45:a59cdb8aaf31
database-connection-manager
Merge
author |
Daniele Nicolodi <nicolodi@science.unitn.it> |
date |
Tue, 06 Dec 2011 19:07:22 +0100 (2011-12-06) |
parents |
f0afece42f48 |
children |
|
line source
function obj = fromDom(obj, node, inhists)
% There exist two possibilities.
%
% first (only one unit object):
% <plistUsed UUID="..." created="..." creator="..." shape="1x1">
% <param key="VALS" shape="1x1" type="double">8</param>
% </plistUsed>
%
% or (empty plist)
% <plistUsed UUID="..." created="..." creator="..." shape="1x1"/>
%
% second:
% <parent>
% <plist UUID="..." created="..." creator="..." shape="1x1">
% <param key="STR" shape="1x4" type="char">text</param>
% <param key="NUM" shape="1x1" type="char">123</param>
% ...
% </plist>
% </parent>
nodeName = utils.xml.mchar(node.getNodeName());
if strcmp(nodeName, 'plistUsed') || strcmp(nodeName, 'plist')
%%%%%%%%%% Call super-class
fromDom@ltpda_uo(obj, node, inhists);
%%%%%%%%%% Get properties from the node attributes
%%%%%%%%%% Get properties from the child nodes
p = [];
% Get params
paramsNodes = utils.xml.getChildrenByName(node, 'param');
for ii=0:paramsNodes.getLength()-1
p = [p param(paramsNodes.item(ii), inhists)];
end
obj.params = p;
else
%%%%%%%%%% Get plists from child nodes
obj = utils.xml.getObject(node);
end
end