put_xml_authors - update authors name and references in xml file
new_tt = put_xml_authors(txt,filen)
- txt : matrix of strings of size (n,2)
- txt(,1) : name of author
- txt(,2) : reference of author
- filen : string. target XML file (path+name)
- new_tt : vector of strings. the text of the new XML file
//put_xml_authors
//Fonction qui insère un
//dans un fichier xml contenant des délimiteurs
//<AUTHORS> et </AUTHORS>
//Entrée : txt : matrice de chaînes de caractères de taille n,2
// txt(,1) : Nom de l'auteur
// txt(,2) : références de l'auteur
// filen : nom du fichier xml (ex:filen=xml_path+'CAN_f.xml')
function new_tt=put_xml_authors(txt,filen)
if fileinfo(filen)<>[] then
if size(txt,2)==2 then
del1='<AUTHORS>'
del2='</AUTHORS>'
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
tt_authors=[]
for j=1:size(txt,1)
tt_authors=[tt_authors;' <AUTHORS_ITEM label='''+txt(j,1)+'''>';
' '+txt(j,2);' </AUTHORS_ITEM>']
end
//Ecrit la chaine de texte finale
new_tt=[tt_sav(1:a);tt_authors;tt_sav(b:size(tt_sav,1))]
end
else
printf("Incompatible rsh variable\n");
end
else
printf("File %s not found\n",filen);
new_tt=[];
end
endfunction
IRCOM Group
Alan Layec