Fonction Scilab
eng - fr


return_xml_param - retourne les paramètres d'un fichier xml

Librairie

Séquence d'appel

txt = return_xml_param(fname)

Paramètres

Description

Add here a paragraph of the function description. Other paragraph can be added

Add here a paragraph of the function description

Exemple

Add here scilab instructions and comments

Contenu du fichier


//return_xml_param
//fonction qui retourne le texte placé entre
//tous les drapeaux <ITEM label=,..> et </ITEM>
//trouvés dans le fichier fname
//ex : return_param(MODNUM+'/man/xml/CAN_f.xml')
//Entrée fname : chemin+nom du fichier xml
//Sortie txt : tableau de chaines de caractères
function txt=return_xml_param(fname)
txt_temp=mgetl(fname);
txt=[]
j=1;
a=[]
if txt_temp<>[] then
 for i=1:size(txt_temp,'*')
  if strindex(txt_temp(i),'<ITEM label=')<>[] then
   a(j,1)=i;
  end;
  if strindex(txt_temp(i),'</ITEM>')<>[] then
   a(j,2)=i;
   j=j+1;
  end
 end
end

for i=1:size(a,'r')
    txt(i,2)=''
    for j=a(i,1):a(i,2)
     if strindex(txt_temp(j),'<ITEM label=')<>[] then
      txt(i,1)=strsubst(txt_temp(j),'<ITEM label=''','')
      txt(i,1)=strsubst(txt(i,1),'''>','')
      if part(txt(i,1),1)==[' '] then
       txt(i,1)=part(txt(i,1),2:length(txt(i,1)))
      end
     end
     if strindex(txt_temp(j),'<ITEM label=')==[] then
       if strindex(txt_temp(j),'</ITEM>')==[] then
              txt(i,2)=txt(i,2)+txt_temp(j);
       end
     end
    end
end

for j=1:size(a,'r')
    while part(txt(j,1),1)==' '
     txt(j,1)=part(txt(j,1),2:length(txt(j,1)));
    end
    while part(txt(j,2),1)==' '
     txt(j,2)=part(txt(j,2),2:length(txt(j,2)));
    end
    txt(j,2)=strsubst(txt(j,2),'<P>','\\');
    txt(j,2)=strsubst(txt(j,2),'</P>','');
    if part(txt(j,2),1)==':' then
     txt(j,2)=part(txt(j,2),2:length(txt(j,2)));
    end
    while part(txt(j,2),1)==' '
     txt(j,2)=part(txt(j,2),2:length(txt(j,2)));
    end
end
endfunction 

Fonction(s) utilisée(s)

Add here the used function name and references

Auteurs

enter here the author name Add here the author references