Mercurial > hg > ltpda
comparison m-toolbox/classes/@param/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 % Get shape | |
5 objShape = utils.xml.getShape(node); | |
6 type = utils.xml.mchar(node.getAttribute('type')); | |
7 | |
8 if any(objShape==0) && isempty(type) | |
9 | |
10 obj = param.initObjectWithSize(objShape(1), objShape(2)); | |
11 | |
12 else | |
13 | |
14 %%%%%%%%%% Call super-class | |
15 | |
16 fromDom@ltpda_nuo(obj, node, inhists); | |
17 | |
18 %%%%%%%%%% Get properties from the node attributes | |
19 | |
20 % Get key | |
21 obj.key = utils.xml.mchar(node.getAttribute('key')); | |
22 | |
23 % Get desc | |
24 obj.desc = utils.xml.mchar(node.getAttribute('desc')); | |
25 | |
26 % Get value | |
27 if node.hasAttribute('type') | |
28 % till LTPDA version 2.3.1 | |
29 obj.setVal(utils.xml.getFromType(node, inhists)); | |
30 else | |
31 | |
32 %%%%%%%%%% Get properties from the child nodes | |
33 % since LTPDA version 2.3.2 | |
34 | |
35 % Get val | |
36 childNode = utils.xml.getChildByName(node, 'val'); | |
37 if ~isempty(childNode) | |
38 obj.setVal(utils.xml.getFromType(childNode, inhists)); | |
39 end | |
40 | |
41 % Get properties | |
42 childNode = utils.xml.getChildByName(node, 'properties'); | |
43 if ~isempty(childNode) | |
44 prop = utils.xml.getStruct(childNode, inhists); | |
45 fn = fieldnames(prop); | |
46 for pp = 1:numel(fn) | |
47 obj.setProperty(fn{pp}, prop.(fn{pp})); | |
48 end | |
49 end | |
50 end | |
51 | |
52 end | |
53 | |
54 end |