Home > classes > @time > private > fromxml.m

fromxml

PURPOSE ^

FROMXML read from part of an XML tree and create a time object.

SYNOPSIS ^

function t = fromxml(xml)

DESCRIPTION ^

 FROMXML read from part of an XML tree and create a time object.

 M Hewitson 28-08-07

 $Id: fromxml.html,v 1.6 2008/02/12 12:18:03 hewitson Exp $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function t = fromxml(xml)
0002 
0003 % FROMXML read from part of an XML tree and create a time object.
0004 %
0005 % M Hewitson 28-08-07
0006 %
0007 % $Id: fromxml.html,v 1.6 2008/02/12 12:18:03 hewitson Exp $
0008 %
0009 
0010 % disp('---------------- time ------------------')
0011 % xml.getNodeName
0012 % disp('---------------- time ------------------')
0013 
0014 sch = xml.getChildNodes;
0015 for c=1:sch.getLength
0016   x = sch.item(c-1);
0017   switch char(x.getNodeName)
0018     case 'name'
0019       name = char(x.getTextContent);
0020     case 'utc_epoch_milli'
0021       utc_epoch_milli = str2num(char(x.getTextContent));
0022     case 'timezone'
0023       timezone = char(x.getTextContent);
0024     case 'timeformat'
0025       xch = x.getChildNodes;
0026       tf = timeformat(xch.item(1));
0027     case 'time_str'
0028       time_str = char(x.getTextContent);
0029     case 'version'
0030       version = char(x.getTextContent);
0031     case 'created'
0032       created = char(x.getTextContent);
0033     otherwise
0034   end
0035 end
0036 
0037 % build time
0038 t = time(utc_epoch_milli);
0039 t = set(t, 'timezone',   timezone);
0040 t = set(t, 'timeformat', tf);
0041 % t = set(t, 'time_str',   time_str); % obsolete because utc_epoch_milli is set
0042 t = set(t, 'name',       name);
0043 t = set(t, 'version',    version);
0044 t = set(t, 'created',    created);
0045 % t = set(t, 'timeformat', tf);
0046 
0047 % END

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