Changeset 1095 for trunk/src/@xmltree/xmltree.m
- Timestamp:
- Mar 31, 2021, 3:32:03 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/@xmltree/xmltree.m
r925 r1095 38 38 % Input argument is an XML string 39 39 if (~exist(varargin{1},'file') && ... 40 ~isempty(xml_findstr(varargin{1},'<',1,1)))40 ~isempty(xml_findstr(varargin{1},'<',1,1))) 41 41 tree.tree = xml_parser(varargin{1}); 42 42 tree.filename = ''; 43 % Input argument is an XML filename43 % Input argument is an XML filename 44 44 else 45 fid = fopen(varargin{1},'rt'); 46 if (fid == -1) 47 error(['[XMLTree] Cannot open ' varargin{1}]); 45 if isempty(regexp(varargin{1},'^http://'))%ordinary file (not OpenDAP) 46 fid = fopen(varargin{1},'rt'); 47 if (fid == -1) 48 error(['[XMLTree] Cannot open ' varargin{1}]); 49 end 50 xmlstr = fread(fid,'*char')'; 51 %xmlstr = fscanf(fid,'%c'); 52 fclose(fid); 53 else 54 xmlstr=webread(varargin{1});%OpenDAP case 48 55 end 49 xmlstr = fread(fid,'*char')';50 %xmlstr = fscanf(fid,'%c');51 fclose(fid);52 56 tree.tree = xml_parser(xmlstr); 53 tree.filename = varargin{1}; 57 tree.filename = varargin{1}; 54 58 end 55 59 tree = class(tree,'xmltree'); 56 else 60 else 57 61 error('[XMLTree] Bad input argument'); 58 62 end
Note: See TracChangeset
for help on using the changeset viewer.