xml_read
PURPOSE 
XML_READ reads an xml file and returns an analysis object.
SYNOPSIS 
function [tag, name, prov, comment, mfile, mfname, mdlfile, mdlfname, hist, data] = xml_read(xmlfile)
DESCRIPTION 
CROSS-REFERENCE INFORMATION 
This function calls:
- xml_read_data XML_READ_DATA read a data object from the given node of an XML DOM
- xml_read_hist XML_READ_HIST read history object from the given node of an XML DOM
- xml_read_provenance XML_READ_PROVENANCE read provenance object from the given node of an XML DOM
This function is called by:
SOURCE CODE 
0001 function [tag, name, prov, comment, mfile, mfname, mdlfile, mdlfname, hist, data] = xml_read(xmlfile)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 ALGONAME = mfilename;
0013 VERSION = '$Id: xml_read.m,v 1.6 2007/07/09 12:43:58 ingo Exp $';
0014
0015 [path,name,ext,versn] = fileparts(xmlfile);
0016
0017
0018 xdoc = xmlread(xmlfile);
0019
0020 ain = xdoc.getElementsByTagName('a');
0021 a = ain.item(0);
0022
0023 children = a.getChildNodes;
0024
0025 tag = -1;
0026 name = '';
0027 prov = [];
0028 comment = '';
0029 mfile = '';
0030 mfname = '';
0031 mdlfile = '';
0032 mdlfname = '';
0033 hist = [];
0034 data = [];
0035
0036
0037 for j=1:children.getLength
0038
0039 ch = children.item(j-1);
0040
0041 nodeName = char(ch.getNodeName);
0042 if ischar(nodeName)
0043 switch nodeName
0044 case 'Tag'
0045 tag = str2num(char(ch.getTextContent));
0046 case 'Name'
0047 name = char(ch.getTextContent);
0048 case 'Provenance'
0049 prov = xml_read_provenance(ch);
0050 case 'Comment'
0051 comment = char(ch.getTextContent);
0052 case 'M-file'
0053 mfile = ltpda_str2cells(char(ch.getTextContent));
0054 case 'Mfilename'
0055 mfname = char(ch.getTextContent);
0056 case 'Mdl-file'
0057 mdlfile = char(ch.getTextContent);
0058 case 'Mdlfilename'
0059 mdlfname = char(ch.getTextContent);
0060 case 'hist'
0061 hist = xml_read_hist(ch);
0062 case 'Data'
0063 data = xml_read_data(ch);
0064 otherwise
0065
0066 end
0067 end
0068 end
Generated on Mon 03-Sep-2007 12:12:34 by m2html © 2003