Home > classes > @pzmodel > xmladd.m

xmladd

PURPOSE ^

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

SYNOPSIS ^

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

DESCRIPTION ^

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

 M Hewitson 14-02-07

 $Id: xmladd.html,v 1.6 2008/02/12 12:17:52 hewitson 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 pzmodel object to the given node of the input XML DOM
0004 % object.
0005 %
0006 % M Hewitson 14-02-07
0007 %
0008 % $Id: xmladd.html,v 1.6 2008/02/12 12:17:52 hewitson Exp $
0009 %
0010 
0011 el = xml.docNode.createElement(nodename);
0012 
0013 for j=1:length(ps)
0014   p = ps(j);
0015 
0016   elc = xml.docNode.createElement('pzmodel');
0017 
0018   % Add gain, poles, zeros
0019 
0020   % add name
0021   elcc = xml.docNode.createElement('name');
0022   elcc.appendChild(xml.docNode.createTextNode(get(p,'name')));
0023   elc.appendChild(elcc);
0024 
0025   % add gain
0026   elcc = xml.docNode.createElement('gain');
0027   elcc.appendChild(xml.docNode.createTextNode(ltpda_mat2str(get(p,'gain'))));
0028   elc.appendChild(elcc);
0029 
0030   % add Created
0031   xml = xmladd(p.created, xml, 'created', elc);
0032 
0033   % add version
0034   elcc = xml.docNode.createElement('version');
0035   elcc.appendChild(xml.docNode.createTextNode(p.version));
0036   elc.appendChild(elcc);
0037 
0038   % add poles
0039   ps = get(p,'poles');
0040   if ~isempty(ps)
0041     xml = xmladd(ps, xml, 'poles', elc);
0042   end
0043 
0044   % add zeros
0045   ps = get(p,'zeros');
0046   if ~isempty(ps)
0047       xml = xmladd(ps, xml, 'zeros', elc);
0048   end
0049   el.appendChild(elc);
0050 end
0051 
0052 node.appendChild(el);
0053 
0054 
0055 
0056 % END

Generated on Tue 12-Feb-2008 13:12:45 by m2html © 2003