comparison m-toolbox/classes/@plist/fromDom.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1
2 function obj = fromDom(obj, node, inhists)
3
4 % There exist two possibilities.
5 %
6 % first (only one unit object):
7 % <plistUsed UUID="..." created="..." creator="..." shape="1x1">
8 % <param key="VALS" shape="1x1" type="double">8</param>
9 % </plistUsed>
10 %
11 % or (empty plist)
12 % <plistUsed UUID="..." created="..." creator="..." shape="1x1"/>
13 %
14 % second:
15 % <parent>
16 % <plist UUID="..." created="..." creator="..." shape="1x1">
17 % <param key="STR" shape="1x4" type="char">text</param>
18 % <param key="NUM" shape="1x1" type="char">123</param>
19 % ...
20 % </plist>
21 % </parent>
22
23 nodeName = utils.xml.mchar(node.getNodeName());
24
25 if strcmp(nodeName, 'plistUsed') || strcmp(nodeName, 'plist')
26
27 %%%%%%%%%% Call super-class
28
29 fromDom@ltpda_uo(obj, node, inhists);
30
31 %%%%%%%%%% Get properties from the node attributes
32
33 %%%%%%%%%% Get properties from the child nodes
34
35 p = [];
36
37 % Get params
38 paramsNodes = utils.xml.getChildrenByName(node, 'param');
39 for ii=0:paramsNodes.getLength()-1
40 p = [p param(paramsNodes.item(ii), inhists)];
41 end
42 obj.params = p;
43
44 else
45
46 %%%%%%%%%% Get plists from child nodes
47 obj = utils.xml.getObject(node);
48
49 end
50
51 end