Home > classes > @ao > private > xml_read.m

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 ^

 XML_READ reads an xml file and returns an analysis object.

 >> b = xml_read(xmlfile)

 M Hewitson 19-02-07

 $Id: xml_read.html,v 1.5 2007/11/07 20:58:33 hewitson Exp $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [tag, name, prov, comment, mfile, mfname, mdlfile, mdlfname, hist, data] = xml_read(xmlfile)
0002 
0003 % XML_READ reads an xml file and returns an analysis object.
0004 %
0005 % >> b = xml_read(xmlfile)
0006 %
0007 % M Hewitson 19-02-07
0008 %
0009 % $Id: xml_read.html,v 1.5 2007/11/07 20:58:33 hewitson Exp $
0010 %
0011 
0012 ALGONAME = mfilename;
0013 VERSION  = '$Id: xml_read.html,v 1.5 2007/11/07 20:58:33 hewitson Exp $';
0014 
0015 [path,name,ext,versn] = fileparts(xmlfile);
0016 
0017 % Read in XML
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 % Go through children of AO object
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 %         warning(['!!! unknown child node: ' nodeName]);
0066     end
0067   end
0068 end

Generated on Tue 06-Nov-2007 12:08:42 by m2html © 2003