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

fromxml

PURPOSE ^

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

SYNOPSIS ^

function h = fromxml(xml)

DESCRIPTION ^

 FROMXML read from part of an XML tree and create a history object.
 
 M Hewitson 28-08-07 
 
 $Id: fromxml.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 h = fromxml(xml)
0002 
0003 % FROMXML read from part of an XML tree and create a history object.
0004 %
0005 % M Hewitson 28-08-07
0006 %
0007 % $Id: fromxml.html,v 1.6 2008/02/12 12:18:04 hewitson Exp $
0008 %
0009 
0010 h = history;
0011 
0012 sch = xml.getChildNodes;
0013 for c=1:sch.getLength
0014   x = sch.item(c-1);
0015   switch char(x.getNodeName)
0016     case 'name'
0017       h = set(h, 'name', char(x.getTextContent));
0018     case 'version'
0019       h = set(h, 'version', char(x.getTextContent));
0020     case 'created'
0021       xch = x.getChildNodes;
0022       h = set(h, 'created', time(xch.item(1)));
0023     case 'n'
0024       h = set(h, 'n', str2num(char(x.getTextContent)));
0025     case 'pn'
0026       h = set(h, 'pn', str2num(char(x.getTextContent)));
0027     case 'consver'
0028       h = set(h, 'consver', char(x.getTextContent));
0029     case 'invars'
0030       h = set(h, 'invars', ltpda_str2cells(char(x.getTextContent)));
0031     case 'plist'
0032       xch = x.getChildNodes;
0033       h = set(h, 'plist', plist(xch.item(1)));
0034     case 'inhists'
0035       xch = x.getChildNodes;
0036       hs = [];
0037       for j=1:xch.getLength
0038         hch = xch.item(j-1);
0039         if strcmp(char(hch.getNodeName), 'history')
0040           hs = [hs history(hch)];
0041         end
0042       end
0043       h = set(h, 'inhists', hs);
0044     otherwise
0045   end
0046 end
0047 
0048 % END

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