Home > classes > @param > xmladd.m

xmladd

PURPOSE ^

XMLADD add a parameter object to the given node of the input XML

SYNOPSIS ^

function xml = xmladd(ps, xml, nodename, node)

DESCRIPTION ^

 XMLADD add a parameter object to the given node of the input XML
 DOM object.

 M Hewitson 14-02-07

 $Id: xml_add_param.m,v 1.5 2007/07/30 12:13:10 ingo Exp $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function xml = xmladd(ps, xml, nodename, node)
0002 
0003 % XMLADD add a parameter object to the given node of the input XML
0004 % DOM object.
0005 %
0006 % M Hewitson 14-02-07
0007 %
0008 % $Id: xml_add_param.m,v 1.5 2007/07/30 12:13:10 ingo Exp $
0009 %
0010 
0011 el = xml.docNode.createElement(nodename);
0012 
0013 for j=1:length(ps)
0014   p = ps(j);
0015   % Now add object
0016   elc = xml.docNode.createElement('param');
0017 
0018   % add version
0019   elcc = xml.docNode.createElement('version');
0020   elcc.appendChild(xml.docNode.createTextNode(p.version));
0021   elc.appendChild(elcc);
0022 
0023   % add key
0024   elcc = xml.docNode.createElement('key');
0025   elcc.appendChild(xml.docNode.createTextNode(p.key));
0026   elc.appendChild(elcc);
0027 
0028   % add value
0029   if ischar(p.val)
0030     elcc = xml.docNode.createElement('value');
0031     elcc.appendChild(xml.docNode.createTextNode(p.val));
0032     elc.appendChild(elcc);
0033   elseif isnumeric(p.val)
0034     elcc = xml.docNode.createElement('value');
0035     elcc.appendChild(xml.docNode.createTextNode(ltpda_mat2str(p.val)));
0036     elc.appendChild(elcc);
0037   else
0038     xml = xmladd(p.val, xml, 'value', elc);
0039   end
0040 
0041   el.appendChild(elc);
0042 end
0043 
0044 node.appendChild(el);
0045 
0046 
0047 
0048 % END

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