Home > classes > @time > xmladd.m

xmladd

PURPOSE ^

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

SYNOPSIS ^

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

DESCRIPTION ^

 XMLADD add a time 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:04 hewitson Exp $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function xml = xmladd(tts, xml, nodename, node)
0002 
0003 % XMLADD add a time 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:04 hewitson Exp $
0009 %
0010 
0011 el = xml.docNode.createElement(nodename);
0012 for j=1:length(tts)
0013   tt = tts(j);
0014   elc = xml.docNode.createElement('time');
0015 
0016   % add name
0017   elcc = xml.docNode.createElement('name');
0018   elcc.appendChild(xml.docNode.createTextNode(get(tt,'name')));
0019   elc.appendChild(elcc);
0020 
0021   % add utc_epoch_milli
0022   elcc = xml.docNode.createElement('utc_epoch_milli');
0023   elcc.appendChild(xml.docNode.createTextNode(num2str(get(tt, 'utc_epoch_milli'))));
0024   elc.appendChild(elcc);
0025 
0026   % add timezone
0027   elcc = xml.docNode.createElement('timezone');
0028   timezone = get(tt, 'timezone');
0029   elcc.appendChild(xml.docNode.createTextNode(char(timezone.getID)));
0030   elc.appendChild(elcc);
0031 
0032   % add timeformat
0033   xml = xmladd(get(tt, 'timeformat'), xml, 'timeformat', elc);
0034 
0035   % add time_str
0036   elcc = xml.docNode.createElement('time_str');
0037   elcc.appendChild(xml.docNode.createTextNode(get(tt, 'time_str')));
0038   elc.appendChild(elcc);
0039 
0040   % add created
0041   elcc = xml.docNode.createElement('created');
0042   elcc.appendChild(xml.docNode.createTextNode(get(tt,'created')));
0043   elc.appendChild(elcc);
0044 
0045   % add version
0046   elcc = xml.docNode.createElement('version');
0047   elcc.appendChild(xml.docNode.createTextNode(get(tt,'version')));
0048   elc.appendChild(elcc);
0049 
0050   el.appendChild(elc);
0051 end
0052 node.appendChild(el);
0053 
0054 
0055 
0056 % END

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