Reads a String from an XML file. Internal function that should never be called directly. Use *xmlLoad* instead. FORMAT result = xmlReadString(fid, attrlist, itype, ftype, binary, fid2) OUT result String IN fid File descriptor of XML file IN attrlist List of tag attributes IN itype Integer type of input file IN ftype Floating point type of input file IN binary Flag. 1 = binary file, 0 = ascii IN fid2 File descriptor of binary file
0001 % Reads a String from an XML file. 0002 % 0003 % Internal function that should never be called directly. 0004 % Use *xmlLoad* instead. 0005 % 0006 % FORMAT result = xmlReadString(fid, attrlist, itype, ftype, binary, fid2) 0007 % 0008 % OUT result String 0009 % IN fid File descriptor of XML file 0010 % IN attrlist List of tag attributes 0011 % IN itype Integer type of input file 0012 % IN ftype Floating point type of input file 0013 % IN binary Flag. 1 = binary file, 0 = ascii 0014 % IN fid2 File descriptor of binary file 0015 0016 % 2003-01-09 Created by Oliver Lemke. 0017 0018 function result = xmlReadString(fid, attrlist, itype, ftype, binary, fid2) 0019 0020 c = fgets (fid, 1); 0021 while ~feof (fid) && (c == 10 || c == 32) 0022 c = fgets (fid, 1); 0023 end 0024 0025 if c ~= '"' 0026 error ('Invalid string: Not starting with "'); 0027 end 0028 0029 % Read the string charwise from input file 0030 % Because matlab removes trailing spaces from strings 0031 % it becomes a bit more complicated. 0032 result = ''; 0033 c = fgets (fid, 1); 0034 while ~feof (fid) && c ~= '"' 0035 result = [result c]; 0036 c = fgets (fid, 1); 0037 end 0038 0039 result = strtrim(result); 0040 0041 if c ~= '"' 0042 error ('Invalid string: Not ending with "'); 0043 end 0044 0045 clear whitespace_count c 0046