Scilab Function
eng - fr


return_xml_authors2 - return authors name and references of a xml file

Library

Calling Sequence

txt = return_xml_authors2(fname)

Parameters

File content


//return_xml_authors2
//fonction qui retourne le texte placé entre
//les deux premiers drapeaux <AUTHOR_ITEM>
//et </AUTHOR_ITEM> trouvés dans le fichier fname
//compatible help skeleton
//ex : txt=return_xml_authors2(MODNUM+'/man/xml/CAN_f.xml')
//Entrée fname : chemin+nom du fichier xml
//Sortie txt : tableau de chaines de caractères de taile n,2
//             txt(1,n) : nom des auteurs
//             txt(2,n) : références des auteurs
function txt=return_xml_authors2(fname)
txt_temp=mgetl(fname);
txt=[]
a=[]
j=1;
if txt_temp<>[] then
 for i=1:size(txt_temp,'*')
  if strindex(txt_temp(i),'<AUTHORS_ITEM ')<>[] then
   a(j,1)=i;
  end
  if strindex(txt_temp(i),'</AUTHORS_ITEM>')<>[] then
   a(j,2)=i;
   j=j+1;
  end
 end

 for i=1:size(a,'r')
   //pour chaque bloc
   txt(i,2)="";
   for j=a(i,1):a(i,2)
    //Trouve le nom de l'auteur
    if(strindex(txt_temp(j),'<AUTHORS_ITEM label='))<>[] then
     txt(i,1)=txt_temp(j);
     b=strindex(txt(i,1),'<AUTHORS_ITEM label=''')
     c=strindex(txt(i,1),'''>')
     txt(i,1)=part(txt(i,1),b:c-1);
     txt(i,1)=strsubst(txt(i,1),'<AUTHORS_ITEM label=''',"");
     txt(i,1)=strsubst(txt(i,1),'''>',"")
     //Enlève les blancs au début
     txt(i,1)=stripblanks_begin(txt(i,1));
     //Enlève les blancs de la fin
     txt(i,1)=stripblanks_end(txt(i,1));
    end
    
    txt(i,2)=txt(i,2)+txt_temp(j);
   end
   
   //Trouve les références de l'auteur
   txt(i,2)=strsubst(txt(i,2),'</AUTHORS_ITEM>',"");
   b=0;
   if strindex(txt(i,2),'<AUTHORS_ITEM label=')<>[] then
    b=strindex(txt(i,2),'<AUTHORS_ITEM label=')
   end
   c=0;
   if strindex(txt(i,2),'>')<>[] then
    c=strindex(txt(i,2),'>');
   end
   if b<>0&c<>0 then
    txt(i,2)=part(txt(i,2),c+1:length(txt(i,2)))
    //Enlève les blancs au début
    txt(i,2)=stripblanks_begin(txt(i,2));
    //Enlève les blancs de la fin
    txt(i,2)=stripblanks_end(txt(i,2));
   end
   if(part(txt(i,2),1))==',' then
    txt(i,2)=part(txt(i,2),2:length(txt(i,2)));
    //Enlève les blancs au début
    txt(i,2)=stripblanks_begin(txt(i,2));
   end
 end
end
endfunction

Authors

IRCOM Group Alan Layec