CaptainLepidus

XML Parser Source 1.1

Feb 29th, 2012
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. {
  2.     ds = ds_map_create();
  3.     var i,j,tt;
  4.     s = 0;
  5.     mode = -1;
  6.     modes = 0;
  7.     for(i=1;i<string_length(argument0)+100;i=i+1)
  8.     {
  9.         cc = 1;
  10.         sc = string_char_at( argument0 , i );
  11.         if string_char_at( argument0 , i ) == '>'
  12.         {
  13.             if modes == 1
  14.             {
  15.                 //show_message( branch[ mode ] );
  16.             }
  17.             modes = 0;
  18.             cc = 0;
  19.         }
  20.         if string_char_at( argument0 , i ) == '<'
  21.         {
  22.             cc = 0;
  23.             if string_char_at( argument0 , i + 1 ) == '/'
  24.             {
  25.                 tt = branch[ 0 ];
  26.                 for(j=1;j<=mode;j=j+1)
  27.                 {
  28.                     tt = tt + '\' + branch[ j ];
  29.                }
  30.                ds_map_add( ds , tt , content[ mode ] );
  31.                mode = mode - 1;
  32.                modes = -1;
  33.            }
  34.            else
  35.            {
  36.                mode = mode + 1;
  37.                modes = 1;
  38.                branch[ mode ] = '';
  39.                content[ mode ] = '';
  40.            }
  41.        }
  42.        if cc == 0 or mode == -1
  43.        {
  44.            //nothing
  45.        }
  46.        else if modes == 1
  47.        {
  48.            branch[ mode ] = branch[ mode ] + sc;
  49.        }
  50.        else if modes == 0
  51.        {
  52.            content[ mode ] = content[ mode ] + sc;
  53.        }
  54.    }
  55.    //word[ j ] = string_copy( argument0 , s , i - s );
  56. }
Advertisement
Add Comment
Please, Sign In to add comment