1 function [SData,SMetaData] =
xmlload(fileName)
4 [~,~,extStr]=fileparts(fileName);
6 fileName = strcat(fileName,
'.xml');
7 elseif ~isequal(lower(extStr),
'.xml')
9 'fileName should point to an xml file');
12 %-----------------------------------------------
13 % check existence of file
15 throwerror('wrongInput:fileDoesntExist','Could not find %s',fileName);
17 %-----------------------------------------------
18 %Use java parser as a temporary tool to check that xml is well-formed
20 %calling built-in xml read function
23 newMeObj=
throwerror('wrongInput:notWellFormedFile',...
24 'xml is not well formed');
25 newMeObj=newMeObj.addCause(meObj);
28 %-----------------------------------------------
29 [fid,errMsgStr] = fopen(fileName, 'r');
32 'Could not open file %s for reading, reason: %s',fileName,...
36 % parse file content into blocks
37 contentStr = fread(fid,'*
char').'; % read in whole file
40 if numel(contentStr)<3
42 '%s does not seem to be a valid xml file.',...
45 %-----------------------------------------------
46 % parse content, identify blocks
function throwerror(in msgTag, in varargin)
THROWERROR works similarly to built-in ERROR function in case when there is no output arguments but s...
function xmlload(in fileName)
XMLLOAD loads XML file and converts it into Matlab structure or variable.
function isfile(in fileName, in isJavaBased)
ISFILE returns true if a specified name corresponds to an existing file.
function xmlparse(in inpXmlString, in attSwitch, in SData, in level)
XMLPARSE parses XML string str and returns matlab variable/structure. This is a non-validating parser...