put_xml_sdesc - update short description in xml file
new_tt = put_xml_sdesc(txt,filen)
- txt : string. short description
- filen : string. target XML file (path+name)
- new_tt : vector of strings. the text of the new XML file
//put_xml_sdesc
//Fonction qui insère une description courte
//dans un fichier xml contenant des délimiteurs
//<SHORT_DESCRIPTION et </SHORT_DESCRIPTION>
//Entrée : txt : chaînes de caractères de taille 1
// contenant la description courte
// filen : nom du fichier xml (ex:filen=xml_path+'CAN_f.xml')
function new_tt=put_xml_sdesc(txt,filen)
if fileinfo(filen)<>[] then
[p,q]=size(txt)
if p==1 & q==1 then
del1='<SHORT_DESCRIPTION'
del2='</SHORT_DESCRIPTION>'
tt_sav=mgetl(filen);
a=0;b=0;new_tt=tt_sav;
//trouve la position des délimiteurs
for i=1:size(tt_sav,1)
if strindex(tt_sav(i),del1)<>[] then a=i, end;
if strindex(tt_sav(i),del2)<>[] then b=i, end;
end
if a<>0&b<>0 then
name=basename(filen)
tt_sdesc=[' <SHORT_DESCRIPTION name='"'+name+''">'+txt+'</SHORT_DESCRIPTION>']
if a==b then
new_tt=[tt_sav(1:a-1);tt_sdesc;tt_sav(b+1:size(tt_sav,1))]
end
end
else
printf("Incompatible rsh variable\n");
end
else
printf("File %s not found\n",filen);
new_tt=[];
end
endfunction
IRCOM Group
Alan Layec