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

fromxml

PURPOSE ^

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

SYNOPSIS ^

function data = fromxml(xml)

DESCRIPTION ^

 FROMXML read from part of an XML tree and create a tsdata object.
 
 M Hewitson 28-08-07 
 
 $Id:$

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function data = fromxml(xml)
0002 
0003 % FROMXML read from part of an XML tree and create a tsdata object.
0004 %
0005 % M Hewitson 28-08-07
0006 %
0007 % $Id:$
0008 %
0009 
0010 % defaults
0011 xunits = '';
0012 yunits = '';
0013 dtype  = '';
0014 
0015 sch = xml.getChildNodes;
0016 for c=1:sch.getLength
0017   x = sch.item(c-1);
0018   switch char(x.getNodeName)
0019     case 'name'
0020       name = char(x.getTextContent);
0021     case 'xunits'
0022       xunits = char(x.getTextContent);
0023     case 'yunits'
0024       yunits = char(x.getTextContent);
0025     case 'version'
0026       version = char(x.getTextContent);
0027     case 'fs'
0028       fs = str2num(char(x.getTextContent));
0029     case 'nsecs'
0030       nsecs = str2num(char(x.getTextContent));
0031     case 't0'
0032       xch = x.getChildNodes;
0033       t0 = time(xch.item(1));
0034     case 'created'
0035       xch = x.getChildNodes;
0036       created = time(xch.item(1));
0037     case 'shape'
0038       shape = str2num(char(x.getTextContent));
0039     case 'dtype'
0040       dtype = char(x.getTextContent); 
0041     case 'data'
0042       idata = ltpda_xml_read_datasamples(x, dtype);
0043     otherwise
0044   end
0045 end
0046 
0047 % build fsdata
0048 data = tsdata();
0049 data = set_xy_axis (data, idata.x, idata.y);
0050 data = set(data, 'fs',   fs);
0051 data = set(data, 't0',    t0);
0052 data = set(data, 'nsecs', nsecs);
0053 
0054 data = set(data, 'name', name);
0055 data = set(data, 'version', version);
0056 data = set(data, 'created', created);
0057 data = set(data, 'xunits', xunits);
0058 data = set(data, 'yunits', yunits);
0059 
0060 
0061 % END

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