0
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
1 % XMLREAD Reads a XML object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
3 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
4 % DESCRIPTION: XMLREAD Reads a XML object.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
5 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
6 % CALL: obj = xmlread(node);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
7 % obj = xmlread(node ,'class');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
8 % obj = xmlread(node ,'ao');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
9 % obj = xmlread(node ,'time');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
10 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
11 % XML HIERARCHY: ---------------------- ltpda_object ----------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
12 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
13 % <ltpda_object>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
14 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
15 % --> <object> ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
16 % --> <cell> ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
17 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
18 % </ltpda_object>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
19 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
20 % ------------------------- object -------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
21 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
22 % <object> ('type' - attribute)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
23 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
24 % <property> ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
25 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
26 % </object>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
27 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
28 % ------------------------ property ------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
29 % -------------------------- cell --------------------------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
30 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
31 % <property> ('type', 'prop_name' -attributes)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
32 % OR <cell> ('type' -attribute)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
33 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
34 % --> atomic element
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
35 % - empty cell
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
36 % - empty double
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
37 % - empty char
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
38 % - char
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
39 % - double
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
40 % - logical
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
41 % - java (necessary for timezone)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
42 % --> <cell> ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
43 % --> <object> ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
44 % --> <real_data> ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
45 % <imag_data> ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
46 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
47 % </property>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
48 % OR </cell>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
49 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
50 % ------- real_data --------|-------- imag_data --------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
51 % |
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
52 % <real_data>('type'-attribute) | <imag_data> ('type' -attribute)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
53 % ('shape'-attribute)| ('shape'-attribute)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
54 % |
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
55 % --> <matrix> ... | --> <matrix> ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
56 % --> <vector> ... | --> <vector> ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
57 % |
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
58 % </real_data> | </imag_data>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
59 % |
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
60 % --------- matrix -------------------- vector ---------
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
61 % |
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
62 % <matrix> ('type' -attribute) | <vector> ('type' -attribute)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
63 % |
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
64 % row vector (double) | column vector (double)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
65 % |
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
66 % </matrix> | </vector>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
67 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
68 % SYMBOLS: --> Marks a choice between alternatives.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
69 % ... Indicate that an element may be repeated.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
70 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
71 % VERSION: $Id: xmlread.m,v 1.8 2011/03/28 17:04:27 ingo Exp $
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
72 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
73 % HISTORY: 31-01-2008 Diepholz
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
74 % Creation
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
75 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
76 % SEE ALSO: utils.xml.xmlwrite
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
77 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
78 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
79 function values = xmlread(rootNode, obj_name)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
80
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
81 % if nargin == 1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
82 % node_name = mchar(rootNode.getNodeName);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
83 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
84 % switch node_name
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
85 % case 'ltpda_object'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
86 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
87 % % Get the xml version from the document node
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
88 % % node.getOwnerDocument.item(0).hasAttribute('ltpda_version')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
89 % if rootNode.hasAttribute('ltpda_version')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
90 % xml_ver = strtok(mchar(rootNode.getAttribute('ltpda_version')));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
91 % else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
92 % xml_ver = '1.0';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
93 % end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
94 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
95 % tbx_ver = strtok(getappdata(0, 'ltpda_version'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
96 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
97 % % set the application data 'xml_ver' if the xml version is lower than the
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
98 % % toolbox version.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
99 % % This application data is nedded in the function xml_read_object to
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
100 % % update the object string.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
101 % if utils.helper.ver2num(xml_ver) < utils.helper.ver2num(tbx_ver)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
102 % update = xml_ver;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
103 % else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
104 % update = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
105 % end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
106 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
107 % values = xml_read_ltpda_object(rootNode, update);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
108 % case 'object'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
109 % values = xml_read_object(rootNode, false);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
110 % case 'property'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
111 % values = xml_read_property_cell(rootNode, false);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
112 % case 'cell'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
113 % values = xml_read_property_cell(rootNode, false);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
114 % case 'real_data'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
115 % values = xml_read_real_imag_data(rootNode);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
116 % case 'imag_data'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
117 % values = xml_read_real_imag_data(rootNode);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
118 % case 'matrix'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
119 % %%%%% row vector
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
120 % values = sscanf(mchar(child_node.getTextContent), '%g ', [1,inf]);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
121 % case 'vector'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
122 % %%%%% column vector
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
123 % values = sscanf(mchar(child_node.getTextContent), '%g ');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
124 % otherwise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
125 % %%%%% Search for the next valid node name.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
126 % for ii = 1:rootNode.getLength
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
127 % item = rootNode.item(ii-1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
128 % if item.hasChildNodes
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
129 % values = utils.xml.xmlread(item);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
130 % end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
131 % end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
132 % end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
133 if nargin >= 1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
134
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
135 values = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
136 valuesShape = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
137 h = history.initObjectWithSize(1,0);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
138
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
139 queryNode = rootNode.getElementsByTagName('ltpda_object');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
140
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
141 for ii= 1:queryNode.getLength
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
142
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
143 LTPDANode = queryNode.item(ii-1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
144 if LTPDANode.getNodeType == LTPDANode.ELEMENT_NODE
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
145
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
146 if LTPDANode.hasAttribute('ltpda_version')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
147 ltpda_version = strtok(utils.xml.mchar(LTPDANode.getAttribute('ltpda_version')));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
148 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
149 ltpda_version = '1.0';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
150 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
151
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
152 if (utils.helper.ver2num(ltpda_version) > utils.helper.ver2num('2.3')) || ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
153 (strcmp(strtok(ltpda_version), '2.3'))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
154 %%%%%%%%%%%%%%%%%% reading of a new XML file %%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
155
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
156 for jj = 1:LTPDANode.getLength
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
157
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
158 objNode = LTPDANode.item(jj-1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
159 if objNode.getNodeType == objNode.ELEMENT_NODE
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
160
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
161 className = utils.xml.mchar(objNode.getNodeName());
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
162
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
163 if strcmp(className, 'historyRoot')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
164
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
165 h = history(objNode, history.initObjectWithSize(1,0));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
166
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
167 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
168 valuesShape = utils.xml.getShape(objNode);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
169 val = feval(className, objNode, h);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
170 if ~exist('obj_name', 'var') || strcmp(class(val), obj_name)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
171 values = [values val];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
172 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
173 error('### Skip the read object because it is from the class [%s] and not from the class [%s].', class(val), obj_name);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
174 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
175 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
176
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
177 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
178 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
179 values = reshape(values, valuesShape);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
180
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
181 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
182 %%%%%%%%%%%%%%%%%% reading of a old XML file %%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
183
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
184 for jj = 1:LTPDANode.getLength
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
185 objNode = LTPDANode.item(jj-1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
186 if objNode.hasChildNodes
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
187 % Get node name
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
188 node_name = utils.xml.mchar(objNode.getNodeName);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
189 switch node_name
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
190 case 'object'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
191 val = xml_read_object(objNode, ltpda_version);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
192 if isempty(valuesShape), valuesShape = getShape(objNode); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
193 if ~exist('obj_name', 'var') || strcmp(class(val), obj_name)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
194 values = [values val];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
195 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
196 error('### Skip the read object because it is from the class [%s] and not from the class [%s].', class(val), obj_name);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
197 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
198 otherwise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
199 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
200 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
201 end % over all childs
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
202
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
203 if ~isempty(valuesShape)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
204 values = reshape(values, valuesShape);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
205 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
206 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
207
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
208 end % LTPDANode.ELEMENT_NODE
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
209
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
210 end % ii= 1:queryNode.getLength
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
211
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
212 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
213 error('### Invalid command of this function');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
214 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
215
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
216
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
217 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
218
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
219
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
220 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
221 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
222 % DESCRIPTION: XML_READ_LTPDA_OBJECT Reads a ltoda_object element with the form:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
223 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
224 % <ltpda_object>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
225 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
226 % --> <object> ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
227 % --> <cell> ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
228 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
229 % </ltpda_object>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
230 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
231 % SYMBOLS: --> Marks a choice between alternatives.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
232 % ... Indicate that an element may be repeated.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
233 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
234 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
235 function values = xml_read_ltpda_object(node, update)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
236
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
237 values = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
238 for ii = 1:node.getLength
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
239 child_node = node.item(ii-1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
240 if child_node.hasChildNodes
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
241 % Get Node name
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
242 node_name = mchar(child_node.getNodeName);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
243 switch node_name
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
244 case 'object'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
245 values = [values xml_read_object(child_node, update)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
246 case 'cell'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
247 values{end+1} = xml_read_property_cell(child_node, update);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
248 otherwise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
249 error('### The ''ltpda_object'' element can not contain a [%s] element.', node_name);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
250 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
251 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
252 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
253 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
254
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
255
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
256 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
257 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
258 % DESCRIPTION: XML_READ_OBJECT Reads a object element with the form:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
259 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
260 % <object> ('type' - attribute)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
261 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
262 % <property> ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
263 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
264 % </object>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
265 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
266 % SYMBOLS: ... Indicate that an element may be repeated.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
267 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
268 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
269 function obj = xml_read_object(node, update)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
270
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
271 obj_type = mchar(node.getAttribute('type'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
272 obj = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
273
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
274 % Set some properties which are stored in the attributes of the 'object' node
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
275 obj = getSpecialObjectAttributes(obj, node, update);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
276
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
277 for ii = 1:node.getLength
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
278 child_node = node.item(ii-1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
279 %%% Read only the property if the node is a ELEMENT_NODE.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
280 if child_node.getNodeType == child_node.ELEMENT_NODE
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
281 % Get node name
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
282 node_name = mchar(child_node.getNodeName);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
283 % get property name from the attribute 'prop_name'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
284 prop_name = mchar(child_node.getAttribute('prop_name'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
285 switch node_name
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
286 case 'property'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
287 prop_value = xml_read_property_cell(child_node, update);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
288
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
289 try
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
290 obj.(prop_name) = prop_value;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
291 catch
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
292 warning('\n\n### Skip the unknown property [%s] in the object [%s]\n', prop_name, class(obj));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
293 disp([char(10) 'Code me up to convert me into the new structure !!!' char(10) ]);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
294 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
295
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
296 otherwise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
297 error('### The ''object'' element can not contain a [%s] element.', node_name);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
298 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
299 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
300 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
301
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
302 if isempty(update)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
303 % Make sure that the version we want to update to is far in the future.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
304 % In other words, we don't do an update if it's not necessary.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
305 update = '1000000000000000';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
306 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
307 old_c = {'timeformat', 'pole', 'zero'};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
308 new_c = {'', 'pz', 'pz'};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
309
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
310 idx = strmatch(obj_type, char(old_c), 'exact');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
311 if ~isempty(idx)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
312 obj_type = new_c{idx};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
313 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
314
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
315 % if ~isempty(obj_type)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
316 % % Update the structure to the current ltpda_version
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
317 % update_fcn = [obj_type '.update_struct'];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
318 % obj = feval(update_fcn, obj, update);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
319 % end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
320 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
321
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
322 if ~isempty(obj_type) && ~strcmp(obj_type, 'struct')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
323 obj.class = obj_type;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
324 obj.tbxver = update;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
325 obj = feval(obj_type, obj);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
326 elseif isempty(obj) && strcmp(obj_type, 'struct')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
327 obj = struct();
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
328 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
329 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
330
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
331
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
332 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
333 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
334 % DESCRIPTION: XML_READ_PROPERTY_CELL Reads a property element or a cell element
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
335 % with the form:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
336 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
337 % <property> ('type', 'prop_name' -attributes)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
338 % OR: <cell> ('type' -attribute)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
339 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
340 % --> atomic element
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
341 % - empty cell
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
342 % - empty double
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
343 % - empty char
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
344 % - char
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
345 % - double
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
346 % - logical
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
347 % - java (necessary for timezone)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
348 % --> <cell> ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
349 % --> <object> ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
350 % --> <real_data> ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
351 % <imag_data> ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
352 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
353 % </property>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
354 % OR: </cell>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
355 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
356 % SYMBOLS: --> Marks a choice between alternatives.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
357 % ... Indicate that an element may be repeated.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
358 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
359 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
360 function prop_value = xml_read_property_cell(node, update)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
361
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
362 prop_value = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
363 real_value = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
364 imag_value = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
365 shape = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
366
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
367 %%% Is the length of the node is equal 1 or zero
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
368 %%% then is the property a atomic element
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
369 if node.getLength == 0 || node.getLength == 1
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
370 prop_value = xml_read_atomic_element(node);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
371 return
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
372 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
373
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
374 for ii = 1:node.getLength
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
375 child_node = node.item(ii-1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
376 if child_node.getNodeType == child_node.ELEMENT_NODE
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
377 %%% Get the node name
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
378 node_name = mchar(child_node.getNodeName);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
379 switch node_name
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
380 case 'cell'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
381 if isempty(shape), shape = getShape(node); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
382 prop_value{end+1} = xml_read_property_cell(child_node, update);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
383 case 'object'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
384 if isempty(shape), shape = getShape(child_node); end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
385 prop_value = [prop_value xml_read_object(child_node, update)];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
386 case 'real_data'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
387 real_value = xml_read_real_imag_data(child_node);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
388 case 'imag_data'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
389 imag_value = xml_read_real_imag_data(child_node);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
390 otherwise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
391 error('### The ''property'' or ''cell'' element can not contain a [%s] element.', node_name);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
392 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
393
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
394 %%% Is real_value and imag_value filled then return the complex value
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
395 if ~isempty(real_value) && ~isempty(imag_value)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
396 prop_value = complex(real_value, imag_value);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
397 %%% Is real_value filled then return the read value
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
398 elseif ~isempty(real_value)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
399 prop_value = real_value;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
400 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
401 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
402 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
403
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
404 %%% Reshape the prop_value if necessary
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
405 if ~isempty(shape)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
406 prop_value = reshape(prop_value, shape);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
407 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
408
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
409 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
410
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
411
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
412 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
413 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
414 % DESCRIPTION: XML_READ_REAL_IMAG_DATA Reads a real_data element or a
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
415 % imag_data element with the form:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
416 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
417 % <real_data> ('type' -attribute) <imag_data> ('type' -attribute)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
418 % ('shape'-attribute) ('shape'-attribute)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
419 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
420 % --> <matrix> ... --> <matrix> ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
421 % --> <vector> ... --> <vector> ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
422 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
423 % </real_data> </imag_data>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
424 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
425 % <matrix> ('type' -attribute) <vector> ('type' -attribute)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
426 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
427 % row vector (double) column vector (double)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
428 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
429 % </matrix> </vector>
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
430 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
431 % SYMBOLS: --> Marks a choice between alternatives.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
432 % ... Indicate that an element may be repeated.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
433 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
434 % REMARK: The matrix elements will be read as a row vector.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
435 % The vector elements will be read as a column vector.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
436 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
437 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
438 function value = xml_read_real_imag_data(node)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
439
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
440 value = [];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
441 header_displayed = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
442
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
443 %%% Get the shape of the matrix/vector
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
444 shape = getShape(node);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
445
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
446 % value = zeros(shape);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
447 % idx = 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
448
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
449 node_name = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
450 for ii = 1:node.getLength
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
451 child_node = node.item(ii-1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
452 if child_node.hasChildNodes
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
453 %%% Get node name
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
454 node_name = mchar(child_node.getNodeName);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
455 %%% Get type
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
456 node_type = mchar(child_node.getAttribute('type'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
457 switch node_name
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
458 case 'matrix'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
459 %%% row vector
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
460 if strcmp(node_type, 'sym')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
461 matrix_row = sym(mchar(child_node.getTextContent));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
462 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
463 matrix_row = sscanf(mchar(child_node.getTextContent), '%g ', [1,inf]);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
464 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
465 value = [value; matrix_row];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
466 % value(idx,:) = matrix_row;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
467 % idx = idx + 1;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
468 case 'vector'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
469 %%% column vector
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
470 if strcmp(node_type, 'sym')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
471 vector_column = sym(mchar(child_node.getTextContent));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
472 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
473 vector_column = sscanf(mchar(child_node.getTextContent), '%g ');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
474 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
475 value = [value; vector_column];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
476 % value(idx:idx + length(vector_column) - 1) = vector_column;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
477 % idx = idx + length(vector_column);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
478 header_displayed = TerminalOutput(node, header_displayed, node_name, length(value));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
479 otherwise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
480 error('### The ''real_data'' or ''imag_data'' element can not contain a [%s] element.', node_name);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
481 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
482 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
483 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
484
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
485 if strcmp(node_name, 'matrix')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
486 header_displayed = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
487 TerminalOutput(node, header_displayed, node_name, size(value,1));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
488 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
489 value = reshape(value, shape);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
490
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
491 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
492
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
493
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
494 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
495 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
496 % DESCRIPTION: xml_read_atomic_element Reads a atomic element.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
497 % This function identify the following types:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
498 % --> atomic element
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
499 % - empty cell
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
500 % - empty double
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
501 % - empty char
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
502 % - char
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
503 % - double
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
504 % - logical
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
505 % - java (necessary for timezone)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
506 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
507 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
508 function values = xml_read_atomic_element(node)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
509
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
510 values = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
511
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
512 type = mchar(node.getAttribute('type'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
513 switch type
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
514 case {'', 'char'}
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
515 shape = getShape(node);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
516 if (any(shape==1))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
517 values = mchar(node.getTextContent);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
518 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
519 values = reshape(mchar(node.getTextContent), shape);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
520 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
521 values = strrep(values, '<NEW_LINE>', '\n');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
522 values = strrep(values, 'CVS_TAG', '$');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
523 %%% Special case if 'values' is empty because
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
524 %%% there are more than an one empty char fields.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
525 %%% For example: '' AND char('', '') AND char('', '', '') AND ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
526 if isempty(values)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
527 if any(shape)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
528 char_str = 'char(';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
529 for ii = 1:max(shape)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
530 char_str = [char_str, ''''', '];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
531 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
532 char_str = char_str(1:end-2);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
533 cmd = strcat('values = ', char_str, ');');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
534 eval(cmd);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
535 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
536 values = '';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
537 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
538 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
539
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
540 case {'double', 'uint64', 'uint32', 'int32', 'int64'}
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
541 number = mchar(node.getTextContent);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
542
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
543 %%% Special case if 'values' is empty because
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
544 %%% there are more than an one empty double fields.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
545 %%% For example: [] AND zeros(1,0) AND zeros(0,1) AND zeros(2,0) AND ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
546 if isempty(number)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
547 shape = getShape(node);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
548 values = zeros(shape);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
549 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
550 values = str2double(number);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
551 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
552
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
553 % cast to other number type
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
554 if strcmp(type, 'uint64')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
555 values = uint64(values);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
556 elseif strcmp(type, 'uint32')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
557 values = uint32(values);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
558 elseif strcmp(type, 'int64')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
559 values = int64(values);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
560 elseif strcmp(type, 'int32')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
561 values = int32(values);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
562 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
563
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
564 case 'sym'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
565 number = mchar(node.getTextContent);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
566
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
567 %%% Special case if 'values' is empty because
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
568 %%% there are more than an one empty double fields.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
569 %%% For example: [] AND zeros(1,0) AND zeros(0,1) AND zeros(2,0) AND ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
570 if isempty(number)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
571 shape = getShape(node);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
572 values = sym(shape);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
573 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
574 values = sym(number);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
575 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
576
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
577 case 'cell'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
578 cell_str = mchar(node.getTextContent);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
579
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
580 %%% Special case if 'values' is empty because
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
581 %%% there are more than an one empty cell fields.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
582 %%% For example: {} AND cell(1,0) AND cell(0,1) AND cell(2,0) AND ...
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
583 if isempty(cell_str)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
584 shape = getShape(node);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
585 values = cell(shape);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
586 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
587 error('### Should not happen because a not empty ''cell'' node have several child nodes.');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
588 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
589
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
590 case 'logical'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
591 cmd = ['logical(' mchar(node.getTextContent) ');'];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
592 values = eval(cmd);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
593
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
594 case 'sun.util.calendar.ZoneInfo'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
595 values = java.util.TimeZone.getTimeZone(mchar(node.getTextContent));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
596
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
597 otherwise
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
598
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
599 if any(strcmp(utils.helper.ltpda_non_abstract_classes, type))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
600 %%% Special case for reading an object with the size Nx0 or 0xN
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
601 shape = getShape(node);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
602 cmd = sprintf('%s.initObjectWithSize', type);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
603 values = feval(cmd, shape(1), shape(2));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
604 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
605 error('### Unknown type attribute [%s].', type');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
606 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
607 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
608 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
609
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
610
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
611 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
612 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
613 % FUNCTION: shape = getShape(node)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
614 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
615 % INPUTS: node - A DOM node with an attribute 'shape'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
616 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
617 % DESCRIPTION: getShape Helper function to get the shape from the
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
618 % attribute 'shape' as a set of double.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
619 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
620 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
621 function shape = getShape(node)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
622 shape = [NaN NaN];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
623 if node.hasAttribute('shape')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
624 shape_str = mchar(node.getAttribute('shape'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
625 x_idx = strfind(shape_str, 'x');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
626 shape = [str2double(shape_str(1:x_idx-1)) str2double(shape_str(x_idx+1:end))];
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
627 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
628 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
629
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
630
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
631 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
632 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
633 % FUNCTION: obj = getSpecialObjectAttributes(obj, node)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
634 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
635 % INPUTS: obj - a object structure or empty array
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
636 % node - A DOM node with the node name 'object'
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
637 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
638 % DESCRIPTION:
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
639 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
640 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
641 function obj = getSpecialObjectAttributes(obj, node, update)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
642
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
643 if strcmp(mchar(node.getNodeName), 'object')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
644
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
645 if strcmp(mchar(node.getAttribute('type')), 'time')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
646
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
647 % Get attributes for a time object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
648 % Check if the attribute exist (necessary for backwards compability)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
649 if (node.hasAttribute('utc'))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
650 obj.utc_epoch_milli = str2double(mchar(node.getAttribute('utc')));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
651 obj.timezone = java.util.TimeZone.getTimeZone(mchar(node.getAttribute('timezone')));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
652 obj.timeformat = mchar(node.getAttribute('timeformat'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
653 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
654
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
655 elseif strcmp(mchar(node.getAttribute('type')), 'provenance')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
656
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
657 % Get attributes for a provenance object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
658 % Check if the attribute exist (necessary for backwards compability)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
659 if (node.hasAttribute('info'))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
660 objStr = mchar(node.getAttribute('info'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
661 obj = provenance.setFromEncodedInfo(obj, objStr);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
662 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
663
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
664 elseif strcmp(mchar(node.getAttribute('type')), 'minfo')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
665
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
666 % Get attributes for a minfo object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
667 % Check if the attribute exist (necessary for backwards compability)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
668 if (node.hasAttribute('info'))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
669 objStr = mchar(node.getAttribute('info'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
670 obj = minfo.setFromEncodedInfo(obj, objStr);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
671 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
672
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
673 elseif strcmp(mchar(node.getAttribute('type')), 'param')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
674
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
675 % Get attributes for a param object
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
676 % Check if the attribute exist (necessary for backwards compability)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
677 if (node.hasAttribute('key'))
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
678 obj.key = mchar(node.getAttribute('key'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
679
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
680 for ii = 1:node.getLength
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
681 childNode = node.item(ii-1);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
682 %%% Read only the property if the node is a ELEMENT_NODE.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
683 if childNode.getNodeType == childNode.ELEMENT_NODE
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
684 obj.val = xml_read_property_cell(childNode, update);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
685 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
686 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
687 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
688
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
689 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
690 % Get general attributes.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
691 if node.hasAttribute('name')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
692 obj.name = mchar(node.getAttribute('name'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
693 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
694 if node.hasAttribute('description')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
695 obj.description = mchar(node.getAttribute('description'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
696 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
697 if node.hasAttribute('UUID')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
698 obj.UUID = mchar(node.getAttribute('UUID'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
699 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
700 if node.hasAttribute('created')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
701 obj.created = str2double(mchar(node.getAttribute('created')));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
702 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
703 if node.hasAttribute('proctime')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
704 obj.proctime = str2double(mchar(node.getAttribute('proctime')));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
705 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
706 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
707
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
708
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
709 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
710 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
711
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
712 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
713 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
714 % FUNCTION: header_displayed = TerminalOutput(node, header_displayed, node_name, number)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
715 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
716 % DESCRIPTION: Displays the terminal output.
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
717 %
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
718 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
719 function header_displayed = TerminalOutput(node, header_displayed, node_name, number)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
720
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
721 import utils.const.*
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
722
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
723 THRESHOLD_DISP_MATRIX = 10;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
724 THRESHOLD_DISP_VECTOR = 1000;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
725
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
726 showing = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
727
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
728 if strcmp(node_name, 'matrix')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
729 if number >= THRESHOLD_DISP_MATRIX
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
730 showing = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
731 add_text = 'matrix lines';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
732 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
733 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
734 if number >= THRESHOLD_DISP_VECTOR
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
735 showing = true;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
736 add_text = 'data samples';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
737 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
738 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
739
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
740 if showing == true
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
741
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
742 parent = node.getParentNode; % The parent node have the 'property name' information
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
743
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
744 if header_displayed == true
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
745 if parent.hasAttribute('prop_name')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
746 disp_prop_name = mchar(parent.getAttribute('prop_name'));
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
747 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
748 disp_prop_name = 'Unknown Property Name';
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
749 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
750 utils.helper.msg(msg.PROC2, 'Reading property: %s', disp_prop_name);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
751
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
752 if strcmp(mchar(node.getNodeName), 'real_data')
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
753 utils.helper.msg(msg.PROC2, 'Reading real data');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
754 else
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
755 utils.helper.msg(msg.PROC2, 'Reading imag data');
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
756 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
757 header_displayed = false;
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
758 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
759
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
760 utils.helper.msg(msg.PROC2, 'Read %d %s', number, add_text);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
761 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
762 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
763
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
764 function c = mchar(s)
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
765 c = cell(s);
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
766 c = c{1};
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
767 end
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
768
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
769
|
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
|
770
|