Home > classes > @timespan > xmladd.m

xmladd

PURPOSE ^

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

SYNOPSIS ^

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

DESCRIPTION ^

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

 Diepholz 23-07-2007

 $Id: xmladd.html,v 1.6 2008/02/12 12:18:00 hewitson Exp $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function xml = xmladd(tss, xml, nodename, node)
0002 
0003 % XMLADD add a timespan object to the given node of the input XML DOM
0004 % object.
0005 %
0006 % Diepholz 23-07-2007
0007 %
0008 % $Id: xmladd.html,v 1.6 2008/02/12 12:18:00 hewitson Exp $
0009 %
0010 
0011 el = xml.docNode.createElement(nodename);
0012 for j=1:length(tss)
0013   ts = tss(j);
0014   elc = xml.docNode.createElement('timespan');
0015 
0016   % add name
0017   elcc = xml.docNode.createElement('name');
0018   elcc.appendChild(xml.docNode.createTextNode(ts.name));
0019   elc.appendChild(elcc);
0020 
0021   % add start time
0022   xml = xmladd(ts.start, xml, 'start', elc);
0023 
0024   % add stop time
0025   xml = xmladd(ts.end, xml, 'end', elc);
0026 
0027   % add timeformat
0028   xml = xmladd(ts.timeformat, xml, 'timeformat', elc);
0029 
0030   % add timezone
0031   elcc = xml.docNode.createElement('timezone');
0032   timezone = ts.timezone;
0033   elcc.appendChild(xml.docNode.createTextNode(char(timezone.getID)));
0034   elc.appendChild(elcc);
0035 
0036   % add created
0037   xml = xmladd(ts.created, xml, 'created', elc);
0038 
0039   % add version
0040   elcc = xml.docNode.createElement('version');
0041   elcc.appendChild(xml.docNode.createTextNode(ts.version));
0042   elc.appendChild(elcc);
0043 
0044   el.appendChild(elc);
0045 end
0046 node.appendChild(el);
0047 
0048 
0049 
0050 % END

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