Home > classes > @ao > private > xml_read_param.m

xml_read_param

PURPOSE ^

XML_READ_PARAM read a parameter from the given input node.

SYNOPSIS ^

function p = xml_read_param(node)

DESCRIPTION ^

 XML_READ_PARAM read a parameter from the given input node.
 
 M Hewitson 16-02-07
 
 $Id: xml_read_param.m,v 1.4 2007/04/24 20:05:22 hewitson Exp $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function p = xml_read_param(node)
0002 
0003 % XML_READ_PARAM read a parameter from the given input node.
0004 %
0005 % M Hewitson 16-02-07
0006 %
0007 % $Id: xml_read_param.m,v 1.4 2007/04/24 20:05:22 hewitson Exp $
0008 %
0009 
0010 
0011 disp('-- reading param');
0012 
0013 p = param();
0014 
0015 children = node.getChildNodes;
0016 
0017 for j=1:children.getLength
0018   
0019   ch = children.item(j-1);  
0020   nodeName = char(ch.getNodeName);
0021   
0022   switch nodeName
0023     case 'Version'
0024       p = set(p, 'version', char(ch.getTextContent));
0025       
0026     case 'Key'
0027       
0028       p = set(p, 'key', char(ch.getTextContent));
0029       
0030     case 'Value'
0031       
0032       mych = ch.getChildNodes;
0033       if mych.getLength > 1
0034         for k=1:mych.getLength
0035           c = mych.item(k-1);
0036           myName = char(c.getNodeName);
0037           switch myName
0038             case 'MIIR'
0039               v = xml_read_miir(c);
0040               p = set(p, 'val', v);              
0041             case 'Specwin'
0042               v = xml_read_specwin(c);
0043               p = set(p, 'val', v);              
0044             case 'PZMODEL'
0045               v = xml_read_pzmodel(c);
0046               p = set(p, 'val', v);
0047 %             otherwise
0048 %               error('### unknown parameter child node.');
0049           end
0050         end
0051         
0052       else
0053         v = char(ch.getTextContent);
0054         if ~isempty(str2num(v))
0055           p = set(p, 'val', str2num(v));
0056         else
0057           p = set(p, 'val', v);
0058         end          
0059       end
0060     otherwise
0061 %       warning(['!!! unknown param field: ' nodeName]);
0062   end
0063   
0064 end
0065 
0066 
0067 
0068 % END

Generated on Mon 03-Sep-2007 12:12:34 by m2html © 2003