source: trunk/src/@xmltree/xmltree.m @ 811

Last change on this file since 811 was 723, checked in by sommeria, 11 years ago

xmltree and toolbox_calib added to svn

File size: 1.4 KB
RevLine 
[723]1function tree = xmltree(varargin)
2% XMLTREE/XMLTREE Constructor of the XMLTree class
3% FORMAT tree = xmltree(varargin)
4%
5% filename - XML filename
6% tree     - XMLTree Object
7%
8%     tree = xmltree;            % creates a minimal XML tree: <tag/>
9%     tree = xmltree(filename);  % creates a tree from an XML file
10%_______________________________________________________________________
11%
12% This is the constructor of the XMLTree class.
13% It creates a tree of an XML 1.0 file (after parsing) that is stored
14% using a Document Object Model (DOM) representation.
15% See http://www.w3.org/TR/REC-xml for details about XML 1.0.
16% See http://www.w3.org/DOM/ for details about DOM platform.
17%_______________________________________________________________________
18% @(#)xmltree.m                 Guillaume Flandin              02/03/27
19
20switch(nargin)
21        case 0
22                tree.tree{1} = struct('type','element',...
23                                      'name','tag',...
24                                                      'attributes',[],...
25                                                      'contents',[],...
26                                                          'parent',[],...
27                                                      'uid',1);
28                tree.filename = '';
29                tree = class(tree,'xmltree');
30        case 1
31                if isa(varargin{1},'xmltree')
32                        tree = varargin{1};
33                elseif ischar(varargin{1})
34                        tree.tree = xml_parser(varargin{1});
35                        tree.filename = varargin{1};
36                        tree = class(tree,'xmltree');
37                else
38                        error('[XMLTree] Bad input argument');
39                end
40        otherwise
41                error('[XMLTree] Bad number of arguments');
42end
Note: See TracBrowser for help on using the repository browser.