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

xdoc2ao

PURPOSE ^

XDOC2AO converts a DOM object to an AO.

SYNOPSIS ^

function aout = xdoc2ao(xdoc)

DESCRIPTION ^

 XDOC2AO converts a DOM object to an AO.

 M Hewitson 16-05-07

 $Id: xdoc2ao.html,v 1.14 2008/03/31 10:27:37 hewitson Exp $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function aout = xdoc2ao(xdoc)
0002 
0003 % XDOC2AO converts a DOM object to an AO.
0004 %
0005 % M Hewitson 16-05-07
0006 %
0007 % $Id: xdoc2ao.html,v 1.14 2008/03/31 10:27:37 hewitson Exp $
0008 %
0009 
0010 ain = xdoc.getElementsByTagName('a');
0011 a = ain.item(0);
0012 
0013 children = a.getChildNodes;
0014 
0015 name       = '';
0016 prov       = [];
0017 description= '';
0018 mfile      = '';
0019 mfname     = '';
0020 mdlfile    = '';
0021 mdlfname   = '';
0022 hist       = [];
0023 data       = [];
0024 
0025 % Go through children of AO object
0026 for j=1:children.getLength
0027 
0028   ch = children.item(j-1);
0029 
0030   nodeName = char(ch.getNodeName);
0031   if ischar(nodeName)
0032     switch nodeName
0033       case 'Name'
0034         name = char(ch.getTextContent);
0035       case 'Provenance'
0036         prov = xml_read_provenance(ch);
0037       case 'Description'
0038         description = char(ch.getTextContent);
0039       case 'M-file'
0040         mfile = char(ch.getTextContent);
0041       case 'Mfilename'
0042         mfname = char(ch.getTextContent);
0043       case 'Mdl-file'
0044         mdlfile = char(ch.getTextContent);
0045       case 'Mdlfilename'
0046         mdlfname = char(ch.getTextContent);
0047       case 'hist'
0048         hist = xml_read_hist(ch);
0049       case 'Data'
0050         data = xml_read_data(ch);
0051       otherwise
0052 %         warning(['!!! unknown child node: ' nodeName]);
0053     end
0054   end
0055 end
0056 
0057 % Now build AO
0058 aout.name        = name;
0059 aout.data        = data;
0060 aout.hist        = hist;
0061 aout.provenance  = prov;
0062 aout.description = description;
0063 aout.mfile       = mfile;
0064 aout.mfilename   = mfname;
0065 aout.mdlfile     = mdlfile;
0066 aout.mdlfilename = mdlfname;
0067 aout = class(aout, 'ao');
0068 
0069

Generated on Mon 31-Mar-2008 12:20:24 by m2html © 2003